/** * Calculates the begin time of this node, in the event that the begin time was not specified. The * begin time is the latest of the end times of its predecessor nodes. */ private void calculateBeginTime() { beginTime = 0; for (Edge edge : enteringEdges) { if (edge.getFromNode().getEndTime() > beginTime) { beginTime = edge.getFromNode().getEndTime(); } } }
/** * given a node find the edge from that node * * @param n the node of interest * @return the edge from that node or <code> null</code> if no edge could be found. */ public Edge getEdgeFromNode(Node n) { for (Edge e : enteringEdges) { if (e.getFromNode() == n) { return e; } } return null; }
/** * Test if a Node has all Edges from the same Nodes and another Node. * * @param n node to check * @return true if this Node has Edges from the same Nodes as n */ protected boolean hasEquivalentEnteringEdges(Node n) { if (enteringEdges.size() != n.getEnteringEdges().size()) { return false; } for (Edge e : enteringEdges) { Node fromNode = e.getFromNode(); if (!n.hasEdgeFromNode(fromNode)) { return false; } } return true; }