Search in sources :

Example 11 with Vertex

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;
}
Also used : Vertex(org.cristalise.kernel.graph.model.Vertex) WfVertex(org.cristalise.kernel.lifecycle.instance.WfVertex)

Example 12 with Vertex

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);
        }
    }
}
Also used : Vertex(org.cristalise.kernel.graph.model.Vertex) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Example 13 with Vertex

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);
        }
    }
}
Also used : Vertex(org.cristalise.kernel.graph.model.Vertex) DirectedEdge(org.cristalise.kernel.graph.model.DirectedEdge) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Example 14 with Vertex

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);
        }
    }
}
Also used : Vertex(org.cristalise.kernel.graph.model.Vertex) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Aggregations

Vertex (org.cristalise.kernel.graph.model.Vertex)14 GraphPoint (org.cristalise.kernel.graph.model.GraphPoint)7 WfVertex (org.cristalise.kernel.lifecycle.instance.WfVertex)3 DirectedEdge (org.cristalise.kernel.graph.model.DirectedEdge)2 ArrayList (java.util.ArrayList)1 Vector (java.util.Vector)1 CollectionArrayList (org.cristalise.kernel.collection.CollectionArrayList)1 InvalidCollectionModification (org.cristalise.kernel.common.InvalidCollectionModification)1 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)1 ObjectAlreadyExistsException (org.cristalise.kernel.common.ObjectAlreadyExistsException)1 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)1 BuiltInVertexProperties (org.cristalise.kernel.graph.model.BuiltInVertexProperties)1 GraphableVertex (org.cristalise.kernel.graph.model.GraphableVertex)1 PropertyDescriptionList (org.cristalise.kernel.property.PropertyDescriptionList)1 CastorHashMap (org.cristalise.kernel.utils.CastorHashMap)1 KeyValuePair (org.cristalise.kernel.utils.KeyValuePair)1