private RouteNodeInstance determineStartNode( Collection<RouteNodeInstance> activeNodes, MovePoint movePoint) throws InvalidActionTakenException { RouteNodeInstance startNodeInstance = null; for (RouteNodeInstance nodeInstance : activeNodes) { if (nodeInstance.getName().equals(movePoint.getStartNodeName())) { if (startNodeInstance != null) { throw new InvalidActionTakenException( "More than one active node exists with the given name: " + movePoint.getStartNodeName()); } startNodeInstance = nodeInstance; } } if (startNodeInstance == null) { throw new InvalidActionTakenException( "Could not locate an active node with the given name: " + movePoint.getStartNodeName()); } return startNodeInstance; }
private String displayMovePoint(MovePoint movePoint) { return "fromNode=" + movePoint.getStartNodeName() + ", stepsToMove=" + movePoint.getStepsToMove(); }