use of org.cristalise.kernel.graph.model.Vertex in project kernel by cristal-ise.
the class LoopDef method verify.
/**
* @see org.cristalise.kernel.lifecycle.WfVertexDef#verify()
*/
@Override
public boolean verify() {
if (!super.verify())
return false;
Vertex[] nexts = getOutGraphables();
Vertex[] anteVertices = GraphTraversal.getTraversal(this.getParent().getChildrenGraphModel(), this, GraphTraversal.kUp, false);
int k = 0;
int l = 0;
Vertex[] brothers = getParent().getChildren();
for (Vertex brother : brothers) if (brother instanceof LoopDef)
l++;
for (Vertex next : nexts) for (Vertex anteVertice : anteVertices) if (next.equals(anteVertice))
k++;
if (k != 1 && !(l > 1)) {
mErrors.add("bad number of pointing back nexts");
return false;
}
// }
return true;
}
use of org.cristalise.kernel.graph.model.Vertex in project kernel by cristal-ise.
the class DefaultGraphLayoutGenerator method visitVertex.
private static void visitVertex(GraphModel graphModel, Vertex vertex, int rowIndex, Vector<Vector<Vertex>> rowVector, Object tag) {
int i = 0;
Vertex[] children = graphModel.getOutVertices(vertex);
vertex.setTag(tag);
addVertexToRow(vertex, rowIndex, rowVector);
for (i = 0; i < children.length; i++) {
if (!(children[i].hasTag(tag))) {
visitVertex(graphModel, children[i], rowIndex + 1, rowVector, tag);
}
}
}
use of org.cristalise.kernel.graph.model.Vertex in project kernel by cristal-ise.
the class DefaultGraphLayoutGenerator method fillInEdgeLocations.
private static void fillInEdgeLocations(GraphModel graphModel) {
Vertex[] vertices = graphModel.getVertices();
GraphPoint centrePoint = null;
DirectedEdge[] inEdges = null;
DirectedEdge[] outEdges = null;
int i = 0;
int j = 0;
for (i = 0; i < vertices.length; i++) {
centrePoint = vertices[i].getCentrePoint();
inEdges = graphModel.getInEdges(vertices[i]);
outEdges = graphModel.getOutEdges(vertices[i]);
for (j = 0; j < inEdges.length; j++) {
inEdges[j].setTerminusPoint(centrePoint);
}
for (j = 0; j < outEdges.length; j++) {
outEdges[j].setOriginPoint(centrePoint);
}
}
}
use of org.cristalise.kernel.graph.model.Vertex in project kernel by cristal-ise.
the class DefaultGraphLayoutGenerator method fillInVertexLocations.
private static void fillInVertexLocations(GraphModel graphModel, Vector<Vector<Vertex>> rowVector, int valueOfLargestMidPoint, int[] midPoints) {
Vector<Vertex> rowsVertices = null;
Vertex vertex = null;
int rowIndex = 0;
int column = 0;
int rowsLeftMargin = 0;
GraphPoint point = new GraphPoint(0, 0);
for (rowIndex = 0; rowIndex < rowVector.size(); rowIndex++) {
rowsVertices = rowVector.elementAt(rowIndex);
rowsLeftMargin = mLeftMargin + valueOfLargestMidPoint - midPoints[rowIndex];
for (column = 0; column < rowsVertices.size(); column++) {
vertex = rowsVertices.elementAt(column);
point.x = rowsLeftMargin + column * mHorzGap;
point.y = mTopMargin + rowIndex * mVertGap;
vertex.moveAbsolute(point);
graphModel.checkSize(vertex);
}
}
}
Aggregations