package com.topcoder.gui.diagramviewer.uml.sequenceelements.edgelayout;

import java.awt.Point;
import java.awt.Rectangle;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.EdgeLayoutException;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.ObjectNode;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.SequenceEdge;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.TestHelper;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.lifeline.LifelineSegment;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.lifeline.TestUtil;

/**
 *

 * Unit TestCases for DefaultEdgeLayoutStrategy class.
 *

 *
 * @author TCSDEVELOPER
 * @version 1.1
 * @since 1.1
 */
public class DefaultEdgeLayoutStrategyTests extends TestCase {

    private DefaultEdgeLayoutStrategy layoutStrategy;

    private List<SequenceEdge> edges;

    /**
     *

     * The edge to nodes mapping for testing use.
     *

     */
    private Map<SequenceEdge, ObjectNode[]> edgeNodeMapping;

    /**
     *

     * Sets up test environment.
     *

     *
     * @throws Exception to JUnit
     */
    protected void setUp() throws Exception {
        this.layoutStrategy = new DefaultEdgeLayoutStrategy();
        edgeNodeMapping = new HashMap<SequenceEdge, ObjectNode[]>();
        edges = TestUtil.createSimpleSequnceEdgeAndAssociation(edgeNodeMapping);
    }

    /**
     *

     * Tears down test environment.
     *

     *
     * @throws Exception to JUnit
     */
    protected void tearDown() throws Exception {
        this.layoutStrategy = null;
    }

    /**
     *

     * Returns the test suite of this class.
     *

     *
     * @return the test suite of this class.
     */
    public static Test suite() {
        return new TestSuite(DefaultEdgeLayoutStrategyTests.class);
    }

    /**
     *

     * Test the default constructor.
     *

     *
     *

     * Test when the edgeSpace is loaded from default.
     *

     */
    public void testCtor_Default() {
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy();
        assertNotNull("Fail to call the default constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in default constuctor", 20, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the default constructor.
     *

     *
     *

     * Test when the edgeSpace is loaded from ConfigManager.
     *

     *
     * @throws Exception to JUnit
     */
    public void testCtor_Config() throws Exception {
        TestHelper.loadXMLConfig(TestHelper.CONFIG_FILE);
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy();
        TestHelper.clearConfig();
        assertNotNull("Fail to call the default constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in default constuctor", 10, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the constructor DefaultEdgeLayoutStrategy(int edgeSpace) for failure.
     *

     *
     *

     * It tests when edgeSpace argument is 0 or negative and expects the IllegalArgumentException.
     *

     */
    public void testCtor_Failure() {
        try {
            new DefaultEdgeLayoutStrategy(0);
            fail("Should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
        try {
            new DefaultEdgeLayoutStrategy(-8);
            fail("Should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
    }

    public void testCtor_Accuracy() {
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy(40);
        assertNotNull("Fail to call the constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in the constuctor", 40, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the setter method setEdgeSpace for failure.
     *

     *
     *

     * It tests when the argument is 0 or negative,and expects the IllegalArgumentException.
     *

     */
    public void testSetEdgeSpace_Fail() {
        try {
            layoutStrategy.setEdgeSpace(0);
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        }
        try {
            layoutStrategy.setEdgeSpace(-1);
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        }
    }

    /**
     *

     * Test the setter method setEdgeSpace for accuracy.
     *

     */
    public void testSetEdgeSpace_Accuracy() {
        layoutS

assertEquals("Fail to set the edgeSpace correctly", 70, layoutStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the getter method getEdgeSpace for accuracy.
     *

     */
    public void testGetEdgeSpace() {
        layoutStrategy.setEdgeSpace(25);
        assertEquals("Fail to get the edgeSpace correctly", 25, layoutStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the edges argument is null,and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullEdges() {
        try {
            layoutStrategy.layout(null, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the edgeNodeMapping argument is null,and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullEdgeNodeMapping() {
        try {
            layoutStrategy.layout(edges, null);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the element in the edges argument is null,and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_NullElementEdge() {
        try {
            edges.set(2, null);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when no value for edge key in the mapping and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullElementMapping1() {
        try {
            SequenceEdge edge = edges.get(3);
            edgeNodeMapping.remove(edge);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the value for edge key in the mapping is null and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_NullElementMapping2() {
        try {
            SequenceEdge edge = edges.get(3);
            edgeNodeMapping.put(edge, null);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the number of the ObjectNode in ObjectNode[] is not equal to 2 , and expects
     * the IllegalArgumentException.
     *

     */
    public void testLayout_InvalidElementMapping1() {
        try {
            SequenceEdge edge = edges.get(1);
            edgeNodeMapping.put(edge, TestUtil.createObjectNodes(3));
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the element of the ObjectNode in ObjectNode[] is null, and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_InvalidElementMapping2() {
        try {
            SequenceEdge edge = edges.get(1);
            ObjectNode[] nodes = TestUtil.createObjectNodes(2);
            nodes[1] = null;
            edgeNodeMapping.put(edge, nodes);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for accuracy.
     *

     */
    public void testLayout_Accuracy() {
        List<LifelineSegment> lsList = null;
        try {
            lsList = layoutStrategy.layout(edges, edgeNodeMapping);
            assertEquals("fail to generate the LifelineSegments correctly", 5, lsList.size());
            // check the layout of LifelineSegments
            LifelineSegment llseg = lsList.get(0);
            Rectangle rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(1);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 40, rect.height);
            llseg = lsList.get(2);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(3);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(4);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            // check the layout of the edge
            SequenceEdge edge = edges.get(0);
            com.topcoder.diagraminterchange.Point left = edge.getGraphEdge().getWaypoints().get(0);
            com.topcoder.diagraminterchange.Point right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 235), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 235), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(1);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 255), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 255), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(2);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 275), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(335, 275), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(3);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(335, 295), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 295), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(4);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 315), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 315), new Point((int) right.getX(), (int) right.getY()));
        } catch (EdgeLayoutException e) {
            fail("should get no Exception");
        }
    }

    /**
     *

     * Test the layout method for accuracy.
     *

     *
     *

     * Test the cases when a SequenceEdge start and end at the same ObjectNode
     *

     */
    public void testLayout_AccuracySameObjNode() {
        List<LifelineSegment> lsList = null;
        edgeNodeMapping = new HashMap<SequenceEdge, ObjectNode[]>();
        edges = TestUtil.createSequnceEdgeAndAssociationSameObjNodes(edgeNodeMapping);
        try {
            lsList = layoutStrategy.layout(edges, edgeNodeMapping);
            assertEquals("fail to generate the LifelineSegments correctly", 5, lsList.size());
            // check the layout of LifelineSegments
            LifelineSegment llseg = lsList.get(0);
            Rectangle rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 60, rect.height);
            llseg = lsList.get(1);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(2);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(3);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(4);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            // check the layout of the edge
            SequenceEdge edge = edges.get(0);
            com.topcoder.diagraminterchange.Point left = edge.getGraphEdge().getWaypoints().get(0);
            com.topcoder.diagraminterchange.Point right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 235), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 235), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(1);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 255), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 255), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(2);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 275), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 275), new Point((int) right.getX(), (int) right.getY()));
            // edge starts and ends with the same ObjectNode
            edge = edges.get(3);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 295), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(285, 295), new Point((int) right.getX(), (int) right.getY()));
            // edge starts and ends with the same ObjectNode
            edge = edges.get(4);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 315), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(285, 315), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(5);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 335), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 335), new Point((int) right.getX(), (int) right.getY()));
        } catch (EdgeLayoutException e) {
            fail("should get no Exception");
        }
    }
}


public void testCtor_Failure() {
        try {
            new DefaultEdgeLayoutStrategy(0);
            fail("Should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
        try {
            new DefaultEdgeLayoutStrategy(-8);
            fail("Should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
    }

package com.topcoder.gui.diagramviewer.uml.sequenceelements.edgelayout;

import java.awt.Point;
import java.awt.Rectangle;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.EdgeLayoutException;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.ObjectNode;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.SequenceEdge;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.TestHelper;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.lifeline.LifelineSegment;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.lifeline.TestUtil;

/**
 *

 * Unit TestCases for DefaultEdgeLayoutStrategy class.
 *

 *
 * @author TCSDEVELOPER
 * @version 1.1
 * @since 1.1
 */
public class DefaultEdgeLayoutStrategyTests extends TestCase {

    private DefaultEdgeLayoutStrategy layoutStrategy;

    private List<SequenceEdge> edges;

    /**
     *

     * The edge to nodes mapping for testing use.
     *

     */
    private Map<SequenceEdge, ObjectNode[]> edgeNodeMapping;

    /**
     *

     * Sets up test environment.
     *

     *
     * @throws Exception to JUnit
     */
    protected void setUp() throws Exception {
        this.layoutStrategy = new DefaultEdgeLayoutStrategy();
        edgeNodeMapping = new HashMap<SequenceEdge, ObjectNode[]>();
        edges = TestUtil.createSimpleSequnceEdgeAndAssociation(edgeNodeMapping);
    }

    /**
     *

     * Tears down test environment.
     *

     *
     * @throws Exception to JUnit
     */
    protected void tearDown() throws Exception {
        this.layoutStrategy = null;
    }

    /**
     *

     * Returns the test suite of this class.
     *

     *
     * @return the test suite of this class.
     */
    public static Test suite() {
        return new TestSuite(DefaultEdgeLayoutStrategyTests.class);
    }

    /**
     *

     * Test the default constructor.
     *

     *
     *

     * Test when the edgeSpace is loaded from default.
     *

     */
    public void testCtor_Default() {
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy();
        assertNotNull("Fail to call the default constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in default constuctor", 20, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the default constructor.
     *

     *
     *

     * Test when the edgeSpace is loaded from ConfigManager.
     *

     *
     * @throws Exception to JUnit
     */
    public void testCtor_Config() throws Exception {
        TestHelper.loadXMLConfig(TestHelper.CONFIG_FILE);
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy();
        TestHelper.clearConfig();
        assertNotNull("Fail to call the default constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in default constuctor", 10, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the constructor DefaultEdgeLayoutStrategy(int edgeSpace) for failure.
     *

     *
     *

     * It tests when edgeSpace argument is 0 or negative and expects the IllegalArgumentException.
     *

     */

public void testCtor_Accuracy() {
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy(40);
        assertNotNull("Fail to call the constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in the constuctor", 40, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the setter method setEdgeSpace for failure.
     *

     *
     *

     * It tests when the argument is 0 or negative,and expects the IllegalArgumentException.
     *

     */
    public void testSetEdgeSpace_Fail() {
        try {
            layoutStrategy.setEdgeSpace(0);
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        }
        try {
            layoutStrategy.setEdgeSpace(-1);
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        }
    }

    /**
     *

     * Test the setter method setEdgeSpace for accuracy.
     *

     */
    public void testSetEdgeSpace_Accuracy() {
        layoutStrategy.setEdgeSpace(70);
        assertEquals("Fail to set the edgeSpace correctly", 70, layoutStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the getter method getEdgeSpace for accuracy.
     *

     */
    public void testGetEdgeSpace() {
        layoutStrategy.setEdgeSpace(25);
        assertEquals("Fail to get the edgeSpace correctly", 25, layoutStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the edges argument is null,and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullEdges() {
        try {
            layoutStrategy.layout(null, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the edgeNodeMapping argument is null,and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullEdgeNodeMapping() {
        try {
            layoutStrategy.layout(edges, null);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the element in the edges argument is null,and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_NullElementEdge() {
        try {
            edges.set(2, null);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when no value for edge key in the mapping and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullElementMapping1() {
        try {
            SequenceEdge edge = edges.get(3);
            edgeNodeMapping.remove(edge);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the value for edge key in the mapping is null and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_NullElementMapping2() {
        try {
            SequenceEdge edge = edges.get(3);
            edgeNodeMapping.put(edge, null);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the number of the ObjectNode in ObjectNode[] is not equal to 2 , and expects
     * the IllegalArgumentException.
     *

     */
    public void testLayout_InvalidElementMapping1() {
        try {
            SequenceEdge edge = edges.get(1);
            edgeNodeMapping.put(edge, TestUtil.createObjectNodes(3));
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the element of the ObjectNode in ObjectNode[] is null, and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_InvalidElementMapping2() {
        try {
            SequenceEdge edge = edges.get(1);
            ObjectNode[] nodes = TestUtil.createObjectNodes(2);
            nodes[1] = null;
            edgeNodeMapping.put(edge, nodes);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for accuracy.
     *

     */
    public void testLayout_Accuracy() {
        List<LifelineSegment> lsList = null;
        try {
            lsList = layoutStrategy.layout(edges, edgeNodeMapping);
            assertEquals("fail to generate the LifelineSegments correctly", 5, lsList.size());
            // check the layout of LifelineSegments
            LifelineSegment llseg = lsList.get(0);
            Rectangle rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(1);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 40, rect.height);
            llseg = lsList.get(2);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(3);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(4);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            // check the layout of the edge
            SequenceEdge edge = edges.get(0);
            com.topcoder.diagraminterchange.Point left = edge.getGraphEdge().getWaypoints().get(0);
            com.topcoder.diagraminterchange.Point right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 235), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 235), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(1);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 255), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 255), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(2);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 275), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(335, 275), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(3);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(335, 295), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 295), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(4);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 315), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 315), new Point((int) right.getX(), (int) right.getY()));
        } catch (EdgeLayoutException e) {
            fail("should get no Exception");
        }
    }

    /**
     *

     * Test the layout method for accuracy.
     *

     *
     *

     * Test the cases when a SequenceEdge start and end at the same ObjectNode
     *

     */
    public void testLayout_AccuracySameObjNode() {
        List<LifelineSegment> lsList = null;
        edgeNodeMapping = new HashMap<SequenceEdge, ObjectNode[]>();
        edges = TestUtil.createSequnceEdgeAndAssociationSameObjNodes(edgeNodeMapping);
        try {
            lsList = layoutStrategy.layout(edges, edgeNodeMapping);
            assertEquals("fail to generate the LifelineSegments correctly", 5, lsList.size());
            // check the layout of LifelineSegments
            LifelineSegment llseg = lsList.get(0);
            Rectangle rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 60, rect.height);
            llseg = lsList.get(1);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(2);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(3);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(4);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            // check the layout of the edge
            SequenceEdge edge = edges.get(0);
            com.topcoder.diagraminterchange.Point left = edge.getGraphEdge().getWaypoints().get(0);
            com.topcoder.diagraminterchange.Point right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 235), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 235), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(1);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 255), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 255), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(2);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 275), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 275), new Point((int) right.getX(), (int) right.getY()));
            // edge starts and ends with the same ObjectNode
            edge = edges.get(3);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 295), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(285, 295), new Point((int) right.getX(), (int) right.getY()));
            // edge starts and ends with the same ObjectNode
            edge = edges.get(4);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 315), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(285, 315), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(5);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 335), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 335), new Point((int) right.getX(), (int) right.getY()));
        } catch (EdgeLayoutException e) {
            fail("should get no Exception");
        }
    }
}


try {
            SequenceEdge edge = edges.get(3);
            edgeNodeMapping.remove(edge);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }

package com.topcoder.gui.diagramviewer.uml.sequenceelements.edgelayout;

import java.awt.Point;
import java.awt.Rectangle;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.EdgeLayoutException;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.ObjectNode;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.SequenceEdge;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.TestHelper;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.lifeline.LifelineSegment;
import com.topcoder.gui.diagramviewer.uml.sequenceelements.lifeline.TestUtil;

/**
 *

 * Unit TestCases for DefaultEdgeLayoutStrategy class.
 *

 *
 * @author TCSDEVELOPER
 * @version 1.1
 * @since 1.1
 */
public class DefaultEdgeLayoutStrategyTests extends TestCase {

    private DefaultEdgeLayoutStrategy layoutStrategy;

    private List<SequenceEdge> edges;

    /**
     *

     * The edge to nodes mapping for testing use.
     *

     */
    private Map<SequenceEdge, ObjectNode[]> edgeNodeMapping;

    /**
     *

     * Sets up test environment.
     *

     *
     * @throws Exception to JUnit
     */
    protected void setUp() throws Exception {
        this.layoutStrategy = new DefaultEdgeLayoutStrategy();
        edgeNodeMapping = new HashMap<SequenceEdge, ObjectNode[]>();
        edges = TestUtil.createSimpleSequnceEdgeAndAssociation(edgeNodeMapping);
    }

    /**
     *

     * Tears down test environment.
     *

     *
     * @throws Exception to JUnit
     */
    protected void tearDown() throws Exception {
        this.layoutStrategy = null;
    }

    /**
     *

     * Returns the test suite of this class.
     *

     *
     * @return the test suite of this class.
     */
    public static Test suite() {
        return new TestSuite(DefaultEdgeLayoutStrategyTests.class);
    }

    /**
     *

     * Test the default constructor.
     *

     *
     *

     * Test when the edgeSpace is loaded from default.
     *

     */
    public void testCtor_Default() {
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy();
        assertNotNull("Fail to call the default constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in default constuctor", 20, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the default constructor.
     *

     *
     *

     * Test when the edgeSpace is loaded from ConfigManager.
     *

     *
     * @throws Exception to JUnit
     */
    public void testCtor_Config() throws Exception {
        TestHelper.loadXMLConfig(TestHelper.CONFIG_FILE);
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy();
        TestHelper.clearConfig();
        assertNotNull("Fail to call the default constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in default constuctor", 10, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the constructor DefaultEdgeLayoutStrategy(int edgeSpace) for failure.
     *

     *
     *

     * It tests when edgeSpace argument is 0 or negative and expects the IllegalArgumentException.
     *

     */
    public void testCtor_Failure() {
        try {
            new DefaultEdgeLayoutStrategy(0);
            fail("Should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
        try {
            new DefaultEdgeLayoutStrategy(-8);
            fail("Should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
    }

    public void testCtor_Accuracy() {
        DefaultEdgeLayoutStrategy defaultStrategy = new DefaultEdgeLayoutStrategy(40);
        assertNotNull("Fail to call the constructor", defaultStrategy);
        assertEquals("Fail to set the member variables in the constuctor", 40, defaultStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the setter method setEdgeSpace for failure.
     *

     *
     *

     * It tests when the argument is 0 or negative,and expects the IllegalArgumentException.
     *

     */
    public void testSetEdgeSpace_Fail() {
        try {
            layoutStrategy.setEdgeSpace(0);
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        }
        try {
            layoutStrategy.setEdgeSpace(-1);
            fail("Should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        }
    }

    /**
     *

     * Test the setter method setEdgeSpace for accuracy.
     *

     */
    public void testSetEdgeSpace_Accuracy() {
        layoutStrategy.setEdgeSpace(70);
        assertEquals("Fail to set the edgeSpace correctly", 70, layoutStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the getter method getEdgeSpace for accuracy.
     *

     */
    public void testGetEdgeSpace() {
        layoutStrategy.setEdgeSpace(25);
        assertEquals("Fail to get the edgeSpace correctly", 25, layoutStrategy.getEdgeSpace());
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the edges argument is null,and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullEdges() {
        try {
            layoutStrategy.layout(null, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the edgeNodeMapping argument is null,and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullEdgeNodeMapping() {
        try {
            layoutStrategy.layout(edges, null);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the element in the edges argument is null,and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_NullElementEdge() {
        try {
            edges.set(2, null);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when no value for edge key in the mapping and expects the IllegalArgumentException.
     *

     */
    public void testLayout_NullElementMapping1() {

}

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the value for edge key in the mapping is null and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_NullElementMapping2() {
        try {
            SequenceEdge edge = edges.get(3);
            edgeNodeMapping.put(edge, null);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the number of the ObjectNode in ObjectNode[] is not equal to 2 , and expects
     * the IllegalArgumentException.
     *

     */
    public void testLayout_InvalidElementMapping1() {
        try {
            SequenceEdge edge = edges.get(1);
            edgeNodeMapping.put(edge, TestUtil.createObjectNodes(3));
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for failure.
     *

     *
     *

     * It tests when the element of the ObjectNode in ObjectNode[] is null, and expects the
     * IllegalArgumentException.
     *

     */
    public void testLayout_InvalidElementMapping2() {
        try {
            SequenceEdge edge = edges.get(1);
            ObjectNode[] nodes = TestUtil.createObjectNodes(2);
            nodes[1] = null;
            edgeNodeMapping.put(edge, nodes);
            layoutStrategy.layout(edges, edgeNodeMapping);
            fail("should get IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // good
        } catch (EdgeLayoutException e) {
            fail("should get IllegalArgumentException");
        }
    }

    /**
     *

     * Test the layout method for accuracy.
     *

     */
    public void testLayout_Accuracy() {
        List<LifelineSegment> lsList = null;
        try {
            lsList = layoutStrategy.layout(edges, edgeNodeMapping);
            assertEquals("fail to generate the LifelineSegments correctly", 5, lsList.size());
            // check the layout of LifelineSegments
            LifelineSegment llseg = lsList.get(0);
            Rectangle rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(1);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 40, rect.height);
            llseg = lsList.get(2);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(3);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(4);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            // check the layout of the edge
            SequenceEdge edge = edges.get(0);
            com.topcoder.diagraminterchange.Point left = edge.getGraphEdge().getWaypoints().get(0);
            com.topcoder.diagraminterchange.Point right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 235), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 235), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(1);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 255), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 255), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(2);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 275), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(335, 275), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(3);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(335, 295), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 295), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(4);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 315), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 315), new Point((int) right.getX(), (int) right.getY()));
        } catch (EdgeLayoutException e) {
            fail("should get no Exception");
        }
    }

    /**
     *

     * Test the layout method for accuracy.
     *

     *
     *

     * Test the cases when a SequenceEdge start and end at the same ObjectNode
     *

     */
    public void testLayout_AccuracySameObjNode() {
        List<LifelineSegment> lsList = null;
        edgeNodeMapping = new HashMap<SequenceEdge, ObjectNode[]>();
        edges = TestUtil.createSequnceEdgeAndAssociationSameObjNodes(edgeNodeMapping);
        try {
            lsList = layoutStrategy.layout(edges, edgeNodeMapping);
            assertEquals("fail to generate the LifelineSegments correctly", 5, lsList.size());
            // check the layout of LifelineSegments
            LifelineSegment llseg = lsList.get(0);
            Rectangle rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 60, rect.height);
            llseg = lsList.get(1);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(2);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(3);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            llseg = lsList.get(4);
            rect = llseg.getSelectionBound();
            assertEquals("fail to layout the LifelineSegments correctly", 20, rect.height);
            // check the layout of the edge
            SequenceEdge edge = edges.get(0);
            com.topcoder.diagraminterchange.Point left = edge.getGraphEdge().getWaypoints().get(0);
            com.topcoder.diagraminterchange.Point right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 235), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 235), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(1);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 255), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(215, 255), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(2);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 275), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 275), new Point((int) right.getX(), (int) right.getY()));
            // edge starts and ends with the same ObjectNode
            edge = edges.get(3);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 295), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(285, 295), new Point((int) right.getX(), (int) right.getY()));
            // edge starts and ends with the same ObjectNode
            edge = edges.get(4);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 315), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(285, 315), new Point((int) right.getX(), (int) right.getY()));
            edge = edges.get(5);
            left = edge.getGraphEdge().getWaypoints().get(0);
            right = edge.getGraphEdge().getWaypoints().get(1);
            assertEquals("fail to layout the SequenceEdge correctly", new Point(275, 335), new Point((int) left.getX(), (int) left.getY()));
            assertEquals("fail to layout the SequenceEdge correctly", new Point(155, 335), new Point((int) right.getX(), (int) right.getY()));
        } catch (EdgeLayoutException e) {
            fail("should get no Exception");
        }
    }
}


/*
 *
 * published by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution. If not, see <http://example.com>.
 *
 * Contributors:
 *     Data Harmonisation Panel <http://www.dhpanel.eu>
 */
package eu.esdihumboldt.hale.common.core.service.cleanup;

import java.io.File;

/**
 * Exposes associated temporary files for external clean up.
 *
 * @author Simon Templer
 */
public interface TemporaryFiles {

    /**
     * Get the temporary files that should be removed when no longer needed
     *
     * @return the temporary files
     */


/*
 * All rights reserved.
 *
 *
 * Created on 16. August 2009 by Joerg Schaible
 */
package com.thoughtworks.xstream.io;

import java.util.Iterator;
import com.thoughtworks.xstream.core.util.Cloneables;
import com.thoughtworks.xstream.io.naming.NameCoder;
import com.thoughtworks.xstream.io.naming.NoNameCoder;

/**
 * Abstract base class for all HierarchicalStreamReader implementations. Implementations of
 * {@link HierarchicalStreamReader} should rather be derived from this class then implementing the interface directly.
 *
 * @author Jörg Schaible
 * @since 1.4
 */
public abstract class AbstractReader implements ExtendedHierarchicalStreamReader {

    private final NameCoder nameCoder;

    /**
     * Creates an AbstractReader with a NameCoder that does nothing.
     *
     * @since 1.4
     */
    protected AbstractReader() {
        this(new NoNameCoder());
    }

    /**
     * Creates an AbstractReader with a provided {@link NameCoder}.
     *
     * @param nameCoder the name coder used to read names from the incoming format
     * @since 1.4
     */
    protected AbstractReader(final NameCoder nameCoder) {
        this.nameCoder = Cloneables.cloneIfPossible(nameCoder);
    }

    @Override
    public HierarchicalStreamReader underlyingReader() {
        return this;
    }

    @Override
    public Iterator<String> getAttributeNames() {
        return new AttributeNameIterator();
    }

    /**
     * Decode a node name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeNode(final String name) {
        return nameCoder.decodeNode(name);
    }

    /**
     * Decode an attribute name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeAttribute(final String name) {
        return nameCoder.decodeAttribute(name);
    }

    /**
     * Encode the node name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */
    protected String encodeNode(final String name) {
        return nameCoder.encodeNode(name);
    }

    /**
     * Encode the attribute name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */
    protected String encodeAttribute(final String name) {
        return nameCoder.encodeAttribute(name);
    }

    @Override
    public String peekNextChild() {
        throw new UnsupportedOperationException("peekNextChild");
    }

    private class AttributeNameIterator implements Iterator<String> {

        private int current;

        private final int count;

        public AttributeNameIterator() {
            count = getAttributeCount();
        }

        @Override
        public boolean hasNext() {
            return current < count;
        }

        @Override
        public String next() {
            return getAttributeName(current++);
        }

{
            throw new UnsupportedOperationException();
        }
    }
}


{
        throw new UnsupportedOperationException("peekNextChild");
    }

/*
 * All rights reserved.
 *
 *
 * Created on 16. August 2009 by Joerg Schaible
 */
package com.thoughtworks.xstream.io;

import java.util.Iterator;
import com.thoughtworks.xstream.core.util.Cloneables;
import com.thoughtworks.xstream.io.naming.NameCoder;
import com.thoughtworks.xstream.io.naming.NoNameCoder;

/**
 * Abstract base class for all HierarchicalStreamReader implementations. Implementations of
 * {@link HierarchicalStreamReader} should rather be derived from this class then implementing the interface directly.
 *
 * @author Jörg Schaible
 * @since 1.4
 */
public abstract class AbstractReader implements ExtendedHierarchicalStreamReader {

    private final NameCoder nameCoder;

    /**
     * Creates an AbstractReader with a NameCoder that does nothing.
     *
     * @since 1.4
     */
    protected AbstractReader() {
        this(new NoNameCoder());
    }

    /**
     * Creates an AbstractReader with a provided {@link NameCoder}.
     *
     * @param nameCoder the name coder used to read names from the incoming format
     * @since 1.4
     */
    protected AbstractReader(final NameCoder nameCoder) {
        this.nameCoder = Cloneables.cloneIfPossible(nameCoder);
    }

    @Override
    public HierarchicalStreamReader underlyingReader() {
        return this;
    }

    @Override
    public Iterator<String> getAttributeNames() {
        return new AttributeNameIterator();
    }

    /**
     * Decode a node name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeNode(final String name) {
        return nameCoder.decodeNode(name);
    }

    /**
     * Decode an attribute name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeAttribute(final String name) {
        return nameCoder.decodeAttribute(name);
    }

    /**
     * Encode the node name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */
    protected String encodeNode(final String name) {
        return nameCoder.encodeNode(name);
    }

    /**
     * Encode the attribute name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */
    protected String encodeAttribute(final String name) {
        return nameCoder.encodeAttribute(name);
    }

    @Override
    public String peekNextChild()

    private class AttributeNameIterator implements Iterator<String> {

        private int current;

        private final int count;

        public AttributeNameIterator() {
            count = getAttributeCount();
        }

        @Override
        public boolean hasNext() {
            return current < count;
        }

        @Override
        public String next() {
            return getAttributeName(current++);
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    }
}


/*
 * All rights reserved.
 *
 *
 * Created on 16. August 2009 by Joerg Schaible
 */
package com.thoughtworks.xstream.io;

import java.util.Iterator;
import com.thoughtworks.xstream.core.util.Cloneables;
import com.thoughtworks.xstream.io.naming.NameCoder;
import com.thoughtworks.xstream.io.naming.NoNameCoder;

/**
 * Abstract base class for all HierarchicalStreamReader implementations. Implementations of
 * {@link HierarchicalStreamReader} should rather be derived from this class then implementing the interface directly.
 *
 * @author Jörg Schaible
 * @since 1.4
 */
public abstract class AbstractReader implements ExtendedHierarchicalStreamReader {

    private final NameCoder nameCoder;

    /**
     * Creates an AbstractReader with a NameCoder that does nothing.
     *
     * @since 1.4
     */
    protected AbstractReader() {
        this(new NoNameCoder());
    }

    /**
     * Creates an AbstractReader with a provided {@link NameCoder}.
     *
     * @param nameCoder the name coder used to read names from the incoming format
     * @since 1.4
     */
    protected AbstractReader(final NameCoder nameCoder) {
        this.nameCoder = Cloneables.cloneIfPossible(nameCoder);
    }

    @Override
    public HierarchicalStreamReader underlyingReader() {
        return this;
    }

    @Override
    public Iterator<String> getAttributeNames() {
        return new AttributeNameIterator();
    }

    /**
     * Decode a node name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeNode(final String name) {
        return nameCoder.decodeNode(name);
    }

    /**
     * Decode an attribute name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeAttribute(final String name) {
        return nameCoder.decodeAttribute(name);
    }

    /**
     * Encode the node name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */
    protected String encodeNode(final String name) {
        return nameCoder.encodeNode(name);
    }

    /**
     * Encode the attribute name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */
    protected String encodeAttribute(final String name) {
        return nameCoder.encodeAttribute(name);
    }

    @Override
    public String peekNextChild() {
        throw new UnsupportedOperationException("peekNextChild");
    }

    private class AttributeNameIterator implements Iterator<String> {

        private int current;

        private final int count;

        public AttributeNameIterator() {
            count = getAttributeCount();
        }

        @Override
        public boolean hasNext() {
            return current < co

        }

        @Override
        public String next() {
            return getAttributeName(current++);
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    }
}


protected String encodeAttribute(final String name) {
        return nameCoder.encodeAttribute(name);
    }

/*
 * All rights reserved.
 *
 *
 * Created on 16. August 2009 by Joerg Schaible
 */
package com.thoughtworks.xstream.io;

import java.util.Iterator;
import com.thoughtworks.xstream.core.util.Cloneables;
import com.thoughtworks.xstream.io.naming.NameCoder;
import com.thoughtworks.xstream.io.naming.NoNameCoder;

/**
 * Abstract base class for all HierarchicalStreamReader implementations. Implementations of
 * {@link HierarchicalStreamReader} should rather be derived from this class then implementing the interface directly.
 *
 * @author Jörg Schaible
 * @since 1.4
 */
public abstract class AbstractReader implements ExtendedHierarchicalStreamReader {

    private final NameCoder nameCoder;

    /**
     * Creates an AbstractReader with a NameCoder that does nothing.
     *
     * @since 1.4
     */
    protected AbstractReader() {
        this(new NoNameCoder());
    }

    /**
     * Creates an AbstractReader with a provided {@link NameCoder}.
     *
     * @param nameCoder the name coder used to read names from the incoming format
     * @since 1.4
     */
    protected AbstractReader(final NameCoder nameCoder) {
        this.nameCoder = Cloneables.cloneIfPossible(nameCoder);
    }

    @Override
    public HierarchicalStreamReader underlyingReader() {
        return this;
    }

    @Override
    public Iterator<String> getAttributeNames() {
        return new AttributeNameIterator();
    }

    /**
     * Decode a node name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeNode(final String name) {
        return nameCoder.decodeNode(name);
    }

    /**
     * Decode an attribute name from the target format.
     *
     * @param name the name in the target format
     * @return the original name
     * @since 1.4
     */
    public String decodeAttribute(final String name) {
        return nameCoder.decodeAttribute(name);
    }

    /**
     * Encode the node name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */
    protected String encodeNode(final String name) {
        return nameCoder.encodeNode(name);
    }

    /**
     * Encode the attribute name again into the name of the target format. Internally used.
     *
     * @param name the original name
     * @return the name in the target format
     * @since 1.4
     */

    @Override
    public String peekNextChild() {
        throw new UnsupportedOperationException("peekNextChild");
    }

    private class AttributeNameIterator implements Iterator<String> {

        private int current;

        private final int count;

        public AttributeNameIterator() {
            count = getAttributeCount();
        }

        @Override
        public boolean hasNext() {
            return current < count;
        }

        @Override
        public String next() {
            return getAttributeName(current++);
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    }
}


package org.gradle.groovy.scripts;

import groovy.lang.Script;
import org.gradle.api.GradleScriptException;

/**
 * Executes a script of type T.
 */
public interface ScriptRunner<T extends Script> extends Runnable {

    /**
     * Returns the script which will be executed by this runner.
     *
     * @return the script.
     */

    /**
     * Executes the script.
     *
     * @throws GradleScriptException On execution failure.
     */
    void run() throws GradleScriptException;
}


@Override
    public Cell merge(Cell m, Cell e)

/*
                    Egothor Software License version 1.00
                      on behalf of the Egothor Project.
                             All rights reserved.

   This  software  is  copyrighted  by  the "Egothor developers". If this
   license applies to a single file or document, the "Egothor developers"
   are the people or entities mentioned as copyright holders in that file
   or  document.  If  this  license  applies  to the Egothor project as a
   whole,  the  copyright holders are the people or entities mentioned in
   the  file CREDITS. This file can be found in the same location as this
   license in the distribution.

       written permission, please contact example@nnthink.com
    4. Products  derived  from this software may not be called "Egothor",
       nor  may  "Egothor"  appear  in  their name, without prior written
       permission from Leo.G@seznam.cz.

   In addition, we request that you include in the end-user documentation
   provided  with  the  redistribution  and/or  in the software itself an
   acknowledgement equivalent to the following:
   "This product includes software developed by the Egothor Project.
    http://example.com"

   created by Leo Galambos (Leo.G@seznam.cz).
 */
package org.egothor.stemmer;

/**
 * The Optimizer class is a Trie that will be reduced (have empty rows removed).
 * <p>
 * This is the result of allowing a joining of rows when there is no collision
 * between non-<tt>null</tt> values in the rows. Information loss, resulting in
 * the stemmer not being able to recognize words (as in Optimizer), is
 * curtailed, allowing the stemmer to recognize words for which the original
 * trie was built. Use of this class allows the stemmer to be self-teaching.
 */
public class Optimizer2 extends Optimizer {

    /**
     * Constructor for the Optimizer2 object.
     */
    public Optimizer2() {
    }

    /**
     * Merge the given Cells and return the resulting Cell.
     *
     * @param m the master Cell
     * @param e the existing Cell
     * @return the resulting Cell, or <tt>null</tt> if the operation cannot be
     *         realized
     */

{
        if (m.cmd == e.cmd && m.ref == e.ref && m.skip == e.skip) {
            Cell c = new Cell(m);
            c.cnt += e.cnt;
            return c;
        } else {
            return null;
        }
    }
}


{
        if (m.cmd == e.cmd && m.ref == e.ref && m.skip == e.skip) {
            Cell c = new Cell(m);
            c.cnt += e.cnt;
            return c;
        } else {
            return null;
        }
    }

/*
                    Egothor Software License version 1.00
                      on behalf of the Egothor Project.
                             All rights reserved.

   This  software  is  copyrighted  by  the "Egothor developers". If this
   license applies to a single file or document, the "Egothor developers"
   are the people or entities mentioned as copyright holders in that file
   or  document.  If  this  license  applies  to the Egothor project as a
   whole,  the  copyright holders are the people or entities mentioned in
   the  file CREDITS. This file can be found in the same location as this
   license in the distribution.

       written permission, please contact example@nnthink.com
    4. Products  derived  from this software may not be called "Egothor",
       nor  may  "Egothor"  appear  in  their name, without prior written
       permission from Leo.G@seznam.cz.

   In addition, we request that you include in the end-user documentation
   provided  with  the  redistribution  and/or  in the software itself an
   acknowledgement equivalent to the following:
   "This product includes software developed by the Egothor Project.
    http://example.com"

   created by Leo Galambos (Leo.G@seznam.cz).
 */
package org.egothor.stemmer;

/**
 * The Optimizer class is a Trie that will be reduced (have empty rows removed).
 * <p>
 * This is the result of allowing a joining of rows when there is no collision
 * between non-<tt>null</tt> values in the rows. Information loss, resulting in
 * the stemmer not being able to recognize words (as in Optimizer), is
 * curtailed, allowing the stemmer to recognize words for which the original
 * trie was built. Use of this class allows the stemmer to be self-teaching.
 */
public class Optimizer2 extends Optimizer {

    /**
     * Constructor for the Optimizer2 object.
     */
    public Optimizer2() {
    }

    /**
     * Merge the given Cells and return the resulting Cell.
     *
     * @param m the master Cell
     * @param e the existing Cell
     * @return the resulting Cell, or <tt>null</tt> if the operation cannot be
     *         realized
     */
    @Override
    public Cell merge(Cell m, Cell e)


@Override
    public Cell merge(Cell m, Cell e) {
        if (m.cmd == e.cmd && m.ref == e.ref && m.skip == e.skip) {
            Cell c = new Cell(m);
            c.cnt += e.cnt;
            return c;
        } else {
            return null;
        }
    }


if (m.cmd == e.cmd && m.ref == e.ref && m.skip == e.skip) {
            Cell c = new Cell(m);
            c.cnt += e.cnt;
            return c;
        } else {
            return null;
        }

/*
                    Egothor Software License version 1.00
                      on behalf of the Egothor Project.
                             All rights reserved.

   This  software  is  copyrighted  by  the "Egothor developers". If this
   license applies to a single file or document, the "Egothor developers"
   are the people or entities mentioned as copyright holders in that file
   or  document.  If  this  license  applies  to the Egothor project as a
   whole,  the  copyright holders are the people or entities mentioned in
   the  file CREDITS. This file can be found in the same location as this
   license in the distribution.

       written permission, please contact example@nnthink.com
    4. Products  derived  from this software may not be called "Egothor",
       nor  may  "Egothor"  appear  in  their name, without prior written
       permission from Leo.G@seznam.cz.

   In addition, we request that you include in the end-user documentation
   provided  with  the  redistribution  and/or  in the software itself an
   acknowledgement equivalent to the following:
   "This product includes software developed by the Egothor Project.
    http://example.com"

   created by Leo Galambos (Leo.G@seznam.cz).
 */
package org.egothor.stemmer;

/**
 * The Optimizer class is a Trie that will be reduced (have empty rows removed).
 * <p>
 * This is the result of allowing a joining of rows when there is no collision
 * between non-<tt>null</tt> values in the rows. Information loss, resulting in
 * the stemmer not being able to recognize words (as in Optimizer), is
 * curtailed, allowing the stemmer to recognize words for which the original
 * trie was built. Use of this class allows the stemmer to be self-teaching.
 */
public class Optimizer2 extends Optimizer {

    /**
     * Constructor for the Optimizer2 object.
     */
    public Optimizer2() {
    }

    /**
     * Merge the given Cells and return the resulting Cell.
     *
     * @param m the master Cell
     * @param e the existing Cell
     * @return the resulting Cell, or <tt>null</tt> if the operation cannot be
     *         realized
     */
    @Override
    public Cell merge(Cell m, Cell e) {


@Override
    protected String getWikiUrl()

/**
 * This file is part of Wikiforia.
 */
package se.lth.cs.nlp.wikipedia.lang;

// Autogenerated from Wikimedia sources at 2015-04-16T13:55:11+00:00
public class IiConfig extends TemplateConfig {

    public IiConfig() {
        addNamespaceAlias(-2, "媒体文件", "媒体");
        addNamespaceAlias(-1, "特殊", "特殊");
        addNamespaceAlias(1, "讨论", "对话", "讨论");
        addNamespaceAlias(2, "用户", "用户");
        addNamespaceAlias(3, "用户讨论", "用户对话", "用户讨论");
        addNamespaceAlias(5, "Wikipedia讨论");
        addNamespaceAlias(6, "文件", "图像", "档案", "文件", "Image");
        addNamespaceAlias(7, "文件讨论", "Image_talk", "图像对话", "图像讨论", "档案对话", "档案讨论", "文件对话", "文件讨论");
        addNamespaceAlias(8, "MediaWiki");
        addNamespaceAlias(9, "MediaWiki讨论");
        addNamespaceAlias(10, "模板", "模板");
        addNamespaceAlias(11, "模板讨论", "模板对话", "模板讨论");
        addNamespaceAlias(12, "帮助", "帮助");
        addNamespaceAlias(13, "帮助讨论", "帮助对话", "帮助讨论");
        addNamespaceAlias(14, "分类", "分类");
        addNamespaceAlias(15, "分类讨论", "分类对话", "分类讨论");
        addI18nCIAlias("redirect", "#重定向", "#REDIRECT");
        addI18nCIAlias("notoc", "__无目录__", "__NOTOC__");
        addI18nCIAlias("nogallery", "__无图库__", "__NOGALLERY__");
        addI18nCIAlias("forcetoc", "__强显目录__", "__FORCETOC__");
        addI18nCIAlias("toc", "__目录__", "__TOC__");
        addI18nCIAlias("noeditsection", "__无编辑段落__", "__无段落编辑__", "__NOEDITSECTION__");
        addI18nAlias("currentmonth", "本月", "本月2", "CURRENTMONTH", "CURRENTMONTH2");
        addI18nAlias("currentmonth1", "本月1", "CURRENTMONTH1");
        addI18nAlias("currentmonthname", "本月名", "本月名称", "CURRENTMONTHNAME");
        addI18nAlias("currentmonthnamegen", "本月名属格", "本月名称属格", "CURRENTMONTHNAMEGEN");
        addI18nAlias("currentmonthabbrev", "本月简称", "CURRENTMONTHABBREV");
        addI18nAlias("currentday", "今天", "CURRENTDAY");
        addI18nAlias("currentday2", "今天2", "CURRENTDAY2");
        addI18nAlias("currentdayname", "星期", "今天名", "今天名称", "CURRENTDAYNAME");
        addI18nAlias("currentyear", "今年", "CURRENTYEAR");
        addI18nAlias("currenttime", "当前时间", "此时", "CURRENTTIME");
        addI18nAlias("currenthour", "当前小时", "CURRENTHOUR");
        addI18nAlias("localmonth", "本地月", "LOCALMONTH", "LOCALMONTH2");
        addI18nAlias("localmonthname", "本地月份名", "LOCALMONTHNAME");
        addI18nAlias("localmonthnamegen", "本地月历", "LOCALMONTHNAMEGEN");
        addI18nAlias("localday", "本地日", "LOCALDAY");
        addI18nAlias("localdayname", "本地日名", "LOCALDAYNAME");
        addI18nAlias("localyear", "本地年", "LOCALYEAR");
        addI18nAlias("localtime", "本地时间", "LOCALTIME");
        addI18nAlias("localhour", "本地小时", "LOCALHOUR");
        addI18nAlias("numberofpages", "页面数", "NUMBEROFPAGES");
        addI18nAlias("numberofarticles", "条目数", "NUMBEROFARTICLES");
        addI18nAlias("numberoffiles", "文件数", "NUMBEROFFILES");
        addI18nAlias("numberofusers", "用户数", "NUMBEROFUSERS");
        addI18nAlias("numberofactiveusers", "活跃用户数", "NUMBEROFACTIVEUSERS");
        addI18nAlias("numberofedits", "编辑数", "NUMBEROFEDITS");
        addI18nAlias("numberofviews", "访问数", "NUMBEROFVIEWS");
        addI18nAlias("pagename", "页名", "页面名", "页面名称", "PAGENAME");
        addI18nAlias("pagenamee", "页名等同", "页面名等同", "页面名E", "PAGENAMEE");
        addI18nAlias("namespace", "名字空间", "NAMESPACE");
        addI18nAlias("namespacee", "名字空间等同", "名字空间E", "NAMESPACEE");
        addI18nAlias("namespacenumber", "名字空间编号", "NAMESPACENUMBER");
        addI18nAlias("talkspace", "讨论空间", "讨论名字空间", "TALKSPACE");
        addI18nAlias("talkspacee", "讨论空间等同", "讨论名字空间E", "TALKSPACEE");
        addI18nAlias("fullpagename", "页面全名", "完整页面名", "FULLPAGENAME");
        addI18nAlias("fullpagenamee", "完整页面名E", "FULLPAGENAMEE");
        addI18nAlias("subpagename", "子页面名", "SUBPAGENAME");
        addI18nAlias("subpagenamee", "子页面名等同", "子页面名E", "SUBPAGENAMEE");
        addI18nAlias("talkpagename", "讨论页面名", "TALKPAGENAME");
        addI18nAlias("talkpagenamee", "讨论页面名等同", "讨论页面名E", "TALKPAGENAMEE");
        addI18nCIAlias("subst", "替代:", "SUBST:");
        addI18nCIAlias("safesubst", "安全替代:", "SAFESUBST:");
        addI18nAlias("img_thumbnail", "缩略图", "thumbnail", "thumb");
        addI18nAlias("img_manualthumb", "缩略图=$1", "thumbnail=$1", "thumb=$1");
        addI18nAlias("img_right", "右", "right");
        addI18nAlias("img_left", "左", "left");
        addI18nAlias("img_none", "无", "none");
        addI18nAlias("img_width", "$1像素", "$1px");
        addI18nAlias("img_center", "居中", "center", "centre");
        addI18nAlias("img_framed", "有框", "framed", "enframed", "frame");
        addI18nAlias("img_frameless", "无框", "frameless");
        addI18nAlias("img_page", "页数=$1", "$1页", "page=$1", "page $1");
        addI18nAlias("img_border", "边框", "border");
        addI18nAlias("img_link", "链接=$1", "link=$1");
        addI18nAlias("img_alt", "替代=$1", "替代文本=$1", "alt=$1");
        addI18nAlias("img_class", "类=$1", "class=$1");
        addI18nCIAlias("int", "界面:", "INT:");
        addI18nAlias("sitename", "站点名称", "SITENAME");
        addI18nCIAlias("ns", "名字空间:", "NS:");
        addI18nCIAlias("nse", "名字空间E:", "NSE:");
        addI18nCIAlias("localurl", "本地URL:", "LOCALURL:");
        addI18nCIAlias("localurle", "本地URLE:", "LOCALURLE:");
        addI18nCIAlias("articlepath", "条目路径", "ARTICLEPATH");
        addI18nCIAlias("pageid", "页面ID", "PAGEID");
        addI18nCIAlias("server", "服务器", "SERVER");
        addI18nCIAlias("servername", "服务器名", "SERVERNAME");
        addI18nCIAlias("scriptpath", "脚本路径", "SCRIPTPATH");
        addI18nCIAlias("stylepath", "样式路径", "STYLEPATH");
        addI18nCIAlias("grammar", "语法:", "GRAMMAR:");
        addI18nCIAlias("gender", "性:", "性别:", "GENDER:");
        addI18nCIAlias("notitleconvert", "__不转换标题__", "__NOTITLECONVERT__", "__NOTC__");
        addI18nCIAlias("nocontentconvert", "__不转换内容__", "__NOCONTENTCONVERT__", "__NOCC__");
        addI18nAlias("currentweek", "本周", "CURRENTWEEK");
        addI18nCIAlias("plural", "复数:", "PLURAL:");
        addI18nCIAlias("fullurl", "完整URL:", "FULLURL:");
        addI18nCIAlias("fullurle", "完整URL等同:", "完整URLE:", "FULLURLE:");
        addI18nCIAlias("lcfirst", "小写首字:", "LCFIRST:");
        addI18nCIAlias("ucfirst", "大写首字:", "UCFIRST:");
        addI18nCIAlias("lc", "小写:", "LC:");
        addI18nCIAlias("uc", "大写:", "UC:");
        addI18nAlias("displaytitle", "显示标题", "DISPLAYTITLE");
        addI18nAlias("newsectionlink", "__新段落链接__", "__NEWSECTIONLINK__");
        addI18nAlias("nonewsectionlink", "__无新段落链接__", "__NONEWSECTIONLINK__");
        addI18nAlias("currentversion", "当前版本", "CURRENTVERSION");
        addI18nCIAlias("urlencode", "URL编码:", "URLENCODE:");
        addI18nCIAlias("anchorencode", "锚编码", "ANCHORENCODE");
        addI18nAlias("currenttimestamp", "当前时间戳", "CURRENTTIMESTAMP");
        addI18nAlias("localtimestamp", "本地时间戳", "LOCALTIMESTAMP");
        addI18nAlias("directionmark", "方向标记", "DIRECTIONMARK", "DIRMARK");
        addI18nCIAlias("language", "#语言:", "#LANGUAGE:");
        addI18nAlias("contentlanguage", "内容语言", "CONTENTLANGUAGE", "CONTENTLANG");
        addI18nAlias("pagesinnamespace", "名字空间中页面数:", "PAGESINNAMESPACE:", "PAGESINNS:");
        addI18nAlias("numberofadmins", "管理员数", "NUMBEROFADMINS");
        addI18nCIAlias("formatnum", "格式化数字", "FORMATNUM");
        addI18nCIAlias("padleft", "左填充", "PADLEFT");
        addI18nCIAlias("padright", "右填充", "PADRIGHT");
        addI18nCIAlias("special", "特殊", "special");
        addI18nCIAlias("speciale", "特殊等同", "特殊e", "speciale");
        addI18nAlias("defaultsort", "默认排序:", "默认排序关键字:", "默认分类排序:", "DEFAULTSORT:", "DEFAULTSORTKEY:", "DEFAULTCATEGORYSORT:");
        addI18nCIAlias("filepath", "文件路径:", "FILEPATH:");
        addI18nCIAlias("tag", "标记", "tag");
        addI18nAlias("hiddencat", "__隐藏分类__", "__HIDDENCAT__");
        addI18nAlias("pagesincategory", "分类中页数", "分类中页面数", "PAGESINCATEGORY", "PAGESINCAT");
        addI18nAlias("pagesize", "页面大小", "PAGESIZE");
        addI18nAlias("index", "__索引__", "__INDEX__");
        addI18nAlias("noindex", "__不索引__", "__NOINDEX__");
        addI18nAlias("numberingroup", "组中用户数", "NUMBERINGROUP", "NUMINGROUP");
        addI18nAlias("staticredirect", "__静态重定向__", "__STATICREDIRECT__");
        addI18nAlias("protectionlevel", "保护级别", "PROTECTIONLEVEL");
        addI18nCIAlias("formatdate", "格式化日期", "日期格式化", "formatdate", "dateformat");
        addI18nCIAlias("defaultsort_noerror", "不报错", "noerror");
        addI18nCIAlias("defaultsort_noreplace", "不替换", "noreplace");
    }

    @Override
    protected String getSiteName() {
        return "Wikipedia";
    }

{
        return "http://example.com";
    }

    @Override
    public String getIso639() {
        return "ii";
    }
}


{
        return "http://example.com";
    }

/**
 * This file is part of Wikiforia.
 */
package se.lth.cs.nlp.wikipedia.lang;

// Autogenerated from Wikimedia sources at 2015-04-16T13:55:11+00:00
public class IiConfig extends TemplateConfig {

    public IiConfig() {
        addNamespaceAlias(-2, "媒体文件", "媒体");
        addNamespaceAlias(-1, "特殊", "特殊");
        addNamespaceAlias(1, "讨论", "对话", "讨论");
        addNamespaceAlias(2, "用户", "用户");
        addNamespaceAlias(3, "用户讨论", "用户对话", "用户讨论");
        addNamespaceAlias(5, "Wikipedia讨论");
        addNamespaceAlias(6, "文件", "图像", "档案", "文件", "Image");
        addNamespaceAlias(7, "文件讨论", "Image_talk", "图像对话", "图像讨论", "档案对话", "档案讨论", "文件对话", "文件讨论");
        addNamespaceAlias(8, "MediaWiki");
        addNamespaceAlias(9, "MediaWiki讨论");
        addNamespaceAlias(10, "模板", "模板");
        addNamespaceAlias(11, "模板讨论", "模板对话", "模板讨论");
        addNamespaceAlias(12, "帮助", "帮助");
        addNamespaceAlias(13, "帮助讨论", "帮助对话", "帮助讨论");
        addNamespaceAlias(14, "分类", "分类");
        addNamespaceAlias(15, "分类讨论", "分类对话", "分类讨论");
        addI18nCIAlias("redirect", "#重定向", "#REDIRECT");
        addI18nCIAlias("notoc", "__无目录__", "__NOTOC__");
        addI18nCIAlias("nogallery", "__无图库__", "__NOGALLERY__");
        addI18nCIAlias("forcetoc", "__强显目录__", "__FORCETOC__");
        addI18nCIAlias("toc", "__目录__", "__TOC__");
        addI18nCIAlias("noeditsection", "__无编辑段落__", "__无段落编辑__", "__NOEDITSECTION__");
        addI18nAlias("currentmonth", "本月", "本月2", "CURRENTMONTH", "CURRENTMONTH2");
        addI18nAlias("currentmonth1", "本月1", "CURRENTMONTH1");
        addI18nAlias("currentmonthname", "本月名", "本月名称", "CURRENTMONTHNAME");
        addI18nAlias("currentmonthnamegen", "本月名属格", "本月名称属格", "CURRENTMONTHNAMEGEN");
        addI18nAlias("currentmonthabbrev", "本月简称", "CURRENTMONTHABBREV");
        addI18nAlias("currentday", "今天", "CURRENTDAY");
        addI18nAlias("currentday2", "今天2", "CURRENTDAY2");
        addI18nAlias("currentdayname", "星期", "今天名", "今天名称", "CURRENTDAYNAME");
        addI18nAlias("currentyear", "今年", "CURRENTYEAR");
        addI18nAlias("currenttime", "当前时间", "此时", "CURRENTTIME");
        addI18nAlias("currenthour", "当前小时", "CURRENTHOUR");
        addI18nAlias("localmonth", "本地月", "LOCALMONTH", "LOCALMONTH2");
        addI18nAlias("localmonthname", "本地月份名", "LOCALMONTHNAME");
        addI18nAlias("localmonthnamegen", "本地月历", "LOCALMONTHNAMEGEN");
        addI18nAlias("localday", "本地日", "LOCALDAY");
        addI18nAlias("localdayname", "本地日名", "LOCALDAYNAME");
        addI18nAlias("localyear", "本地年", "LOCALYEAR");
        addI18nAlias("localtime", "本地时间", "LOCALTIME");
        addI18nAlias("localhour", "本地小时", "LOCALHOUR");
        addI18nAlias("numberofpages", "页面数", "NUMBEROFPAGES");
        addI18nAlias("numberofarticles", "条目数", "NUMBEROFARTICLES");
        addI18nAlias("numberoffiles", "文件数", "NUMBEROFFILES");
        addI18nAlias("numberofusers", "用户数", "NUMBEROFUSERS");
        addI18nAlias("numberofactiveusers", "活跃用户数", "NUMBEROFACTIVEUSERS");
        addI18nAlias("numberofedits", "编辑数", "NUMBEROFEDITS");
        addI18nAlias("numberofviews", "访问数", "NUMBEROFVIEWS");
        addI18nAlias("pagename", "页名", "页面名", "页面名称", "PAGENAME");
        addI18nAlias("pagenamee", "页名等同", "页面名等同", "页面名E", "PAGENAMEE");
        addI18nAlias("namespace", "名字空间", "NAMESPACE");
        addI18nAlias("namespacee", "名字空间等同", "名字空间E", "NAMESPACEE");
        addI18nAlias("namespacenumber", "名字空间编号", "NAMESPACENUMBER");
        addI18nAlias("talkspace", "讨论空间", "讨论名字空间", "TALKSPACE");
        addI18nAlias("talkspacee", "讨论空间等同", "讨论名字空间E", "TALKSPACEE");
        addI18nAlias("fullpagename", "页面全名", "完整页面名", "FULLPAGENAME");
        addI18nAlias("fullpagenamee", "完整页面名E", "FULLPAGENAMEE");
        addI18nAlias("subpagename", "子页面名", "SUBPAGENAME");
        addI18nAlias("subpagenamee", "子页面名等同", "子页面名E", "SUBPAGENAMEE");
        addI18nAlias("talkpagename", "讨论页面名", "TALKPAGENAME");
        addI18nAlias("talkpagenamee", "讨论页面名等同", "讨论页面名E", "TALKPAGENAMEE");
        addI18nCIAlias("subst", "替代:", "SUBST:");
        addI18nCIAlias("safesubst", "安全替代:", "SAFESUBST:");
        addI18nAlias("img_thumbnail", "缩略图", "thumbnail", "thumb");
        addI18nAlias("img_manualthumb", "缩略图=$1", "thumbnail=$1", "thumb=$1");
        addI18nAlias("img_right", "右", "right");
        addI18nAlias("img_left", "左", "left");
        addI18nAlias("img_none", "无", "none");
        addI18nAlias("img_width", "$1像素", "$1px");
        addI18nAlias("img_center", "居中", "center", "centre");
        addI18nAlias("img_framed", "有框", "framed", "enframed", "frame");
        addI18nAlias("img_frameless", "无框", "frameless");
        addI18nAlias("img_page", "页数=$1", "$1页", "page=$1", "page $1");
        addI18nAlias("img_border", "边框", "border");
        addI18nAlias("img_link", "链接=$1", "link=$1");
        addI18nAlias("img_alt", "替代=$1", "替代文本=$1", "alt=$1");
        addI18nAlias("img_class", "类=$1", "class=$1");
        addI18nCIAlias("int", "界面:", "INT:");
        addI18nAlias("sitename", "站点名称", "SITENAME");
        addI18nCIAlias("ns", "名字空间:", "NS:");
        addI18nCIAlias("nse", "名字空间E:", "NSE:");
        addI18nCIAlias("localurl", "本地URL:", "LOCALURL:");
        addI18nCIAlias("localurle", "本地URLE:", "LOCALURLE:");
        addI18nCIAlias("articlepath", "条目路径", "ARTICLEPATH");
        addI18nCIAlias("pageid", "页面ID", "PAGEID");
        addI18nCIAlias("server", "服务器", "SERVER");
        addI18nCIAlias("servername", "服务器名", "SERVERNAME");
        addI18nCIAlias("scriptpath", "脚本路径", "SCRIPTPATH");
        addI18nCIAlias("stylepath", "样式路径", "STYLEPATH");
        addI18nCIAlias("grammar", "语法:", "GRAMMAR:");
        addI18nCIAlias("gender", "性:", "性别:", "GENDER:");
        addI18nCIAlias("notitleconvert", "__不转换标题__", "__NOTITLECONVERT__", "__NOTC__");
        addI18nCIAlias("nocontentconvert", "__不转换内容__", "__NOCONTENTCONVERT__", "__NOCC__");
        addI18nAlias("currentweek", "本周", "CURRENTWEEK");
        addI18nCIAlias("plural", "复数:", "PLURAL:");
        addI18nCIAlias("fullurl", "完整URL:", "FULLURL:");
        addI18nCIAlias("fullurle", "完整URL等同:", "完整URLE:", "FULLURLE:");
        addI18nCIAlias("lcfirst", "小写首字:", "LCFIRST:");
        addI18nCIAlias("ucfirst", "大写首字:", "UCFIRST:");
        addI18nCIAlias("lc", "小写:", "LC:");
        addI18nCIAlias("uc", "大写:", "UC:");
        addI18nAlias("displaytitle", "显示标题", "DISPLAYTITLE");
        addI18nAlias("newsectionlink", "__新段落链接__", "__NEWSECTIONLINK__");
        addI18nAlias("nonewsectionlink", "__无新段落链接__", "__NONEWSECTIONLINK__");
        addI18nAlias("currentversion", "当前版本", "CURRENTVERSION");
        addI18nCIAlias("urlencode", "URL编码:", "URLENCODE:");
        addI18nCIAlias("anchorencode", "锚编码", "ANCHORENCODE");
        addI18nAlias("currenttimestamp", "当前时间戳", "CURRENTTIMESTAMP");
        addI18nAlias("localtimestamp", "本地时间戳", "LOCALTIMESTAMP");
        addI18nAlias("directionmark", "方向标记", "DIRECTIONMARK", "DIRMARK");
        addI18nCIAlias("language", "#语言:", "#LANGUAGE:");
        addI18nAlias("contentlanguage", "内容语言", "CONTENTLANGUAGE", "CONTENTLANG");
        addI18nAlias("pagesinnamespace", "名字空间中页面数:", "PAGESINNAMESPACE:", "PAGESINNS:");
        addI18nAlias("numberofadmins", "管理员数", "NUMBEROFADMINS");
        addI18nCIAlias("formatnum", "格式化数字", "FORMATNUM");
        addI18nCIAlias("padleft", "左填充", "PADLEFT");
        addI18nCIAlias("padright", "右填充", "PADRIGHT");
        addI18nCIAlias("special", "特殊", "special");
        addI18nCIAlias("speciale", "特殊等同", "特殊e", "speciale");
        addI18nAlias("defaultsort", "默认排序:", "默认排序关键字:", "默认分类排序:", "DEFAULTSORT:", "DEFAULTSORTKEY:", "DEFAULTCATEGORYSORT:");
        addI18nCIAlias("filepath", "文件路径:", "FILEPATH:");
        addI18nCIAlias("tag", "标记", "tag");
        addI18nAlias("hiddencat", "__隐藏分类__", "__HIDDENCAT__");
        addI18nAlias("pagesincategory", "分类中页数", "分类中页面数", "PAGESINCATEGORY", "PAGESINCAT");
        addI18nAlias("pagesize", "页面大小", "PAGESIZE");
        addI18nAlias("index", "__索引__", "__INDEX__");
        addI18nAlias("noindex", "__不索引__", "__NOINDEX__");
        addI18nAlias("numberingroup", "组中用户数", "NUMBERINGROUP", "NUMINGROUP");
        addI18nAlias("staticredirect", "__静态重定向__", "__STATICREDIRECT__");
        addI18nAlias("protectionlevel", "保护级别", "PROTECTIONLEVEL");
        addI18nCIAlias("formatdate", "格式化日期", "日期格式化", "formatdate", "dateformat");
        addI18nCIAlias("defaultsort_noerror", "不报错", "noerror");
        addI18nCIAlias("defaultsort_noreplace", "不替换", "noreplace");
    }

    @Override
    protected String getSiteName() {
        return "Wikipedia";
    }

    @Override
    protected String getWikiUrl()

    @Override
    public String getIso639() {
        return "ii";
    }
}