use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.
the class TestGraphCreator method getOneNodeGraph.
/**
* Creates graph with only one node.
*
* @return graph with only one node.
*/
public LGraph getOneNodeGraph() {
Layer layer = makeLayer();
addNodeToLayer(layer);
setUpIds();
return graph;
}
use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.
the class TestGraphCreator method getFixedPortOrderInLayerEdgesDontCrossEachOther.
/**
* <pre>
* ____
* | |----
* |__|\ |
* ____ | |
* | |/ |
* |__|---|
* .
* </pre>
*
* Port order fixed.
*
* @return Graph of the form above.
*/
public LGraph getFixedPortOrderInLayerEdgesDontCrossEachOther() {
Layer layer = makeLayer();
LNode[] nodes = addNodesToLayer(2, layer);
setFixedOrderConstraint(nodes[0]);
setFixedOrderConstraint(nodes[1]);
// must add ports and edges manually, due to clockwise port ordering
LPort upperPortUpperNode = addPortOnSide(nodes[0], PortSide.EAST);
LPort lowerPortUpperNode = addPortOnSide(nodes[0], PortSide.EAST);
LPort upperPortLowerNode = addPortOnSide(nodes[1], PortSide.EAST);
LPort lowerPortLowerNode = addPortOnSide(nodes[1], PortSide.EAST);
addEdgeBetweenPorts(upperPortUpperNode, lowerPortLowerNode);
addEdgeBetweenPorts(lowerPortUpperNode, upperPortLowerNode);
setUpIds();
return graph;
}
use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.
the class TestGraphCreator method multipleInBetweenLayerEdgesIntoNodeWithNoFixedPortOrder.
/**
* <pre>
* ---*
* |
* | ____
* *+-| |
* *+-| |
* \|__|
* Port order not fixed.
* .
* </pre>
*
* @return Graph of the form above.
*/
public LGraph multipleInBetweenLayerEdgesIntoNodeWithNoFixedPortOrder() {
Layer leftLayer = makeLayer();
LNode[] leftNodes = addNodesToLayer(2, leftLayer);
Layer rightLayer = makeLayer();
LNode[] rightNodes = addNodesToLayer(2, rightLayer);
addInLayerEdge(rightNodes[0], rightNodes[1], PortSide.WEST);
eastWestEdgeFromTo(leftNodes[0], rightNodes[1]);
eastWestEdgeFromTo(leftNodes[0], rightNodes[1]);
setUpIds();
return graph;
}
use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.
the class TestGraphCreator method getInLayerEdgesGraph.
/**
* <pre>
* --*
* |
* *-+-*-*
* |
* --*
* .
* </pre>
*
* @return graph of the form above
*/
public LGraph getInLayerEdgesGraph() {
Layer leftLayer = makeLayer();
Layer middleLayer = makeLayer();
Layer rightLayer = makeLayer();
LNode leftNode = addNodeToLayer(leftLayer);
LNode[] middleNodes = addNodesToLayer(3, middleLayer);
LNode rightNode = addNodeToLayer(rightLayer);
// add east side ports first to get expected port ordering
eastWestEdgeFromTo(middleNodes[1], rightNode);
eastWestEdgeFromTo(leftNode, middleNodes[1]);
addInLayerEdge(middleNodes[0], middleNodes[2], PortSide.WEST);
setUpIds();
return graph;
}
use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.
the class TestGraphCreator method getCrossFormedGraphConstraintsPreventAnySwitch.
/**
* <pre>
* this node must be.. -> * * <- and this node must be ...
* \/
* /\
* before this node -> * * <- before this node.
* .
* </pre>
*
* @return Graph of the form above.
*/
public LGraph getCrossFormedGraphConstraintsPreventAnySwitch() {
Layer leftLayer = makeLayer();
Layer rightLayer = makeLayer();
LNode topLeft = addNodeToLayer(leftLayer);
LNode bottomLeft = addNodeToLayer(leftLayer);
LNode topRight = addNodeToLayer(rightLayer);
LNode bottomRight = addNodeToLayer(rightLayer);
eastWestEdgeFromTo(topLeft, bottomRight);
eastWestEdgeFromTo(bottomLeft, topRight);
setInLayerOrderConstraint(topRight, bottomRight);
setInLayerOrderConstraint(topLeft, bottomLeft);
setUpIds();
return graph;
}
Aggregations