private void addNode(String nodeId, Coordinate nodeCoord) { Node node = graph.addNode(nodeId); node.addAttribute("x", nodeCoord.getX()); node.addAttribute("y", nodeCoord.getY()); }
private void addVehicle(Vehicle vehicle) { String startId = makeStartId(vehicle); Node node = graph.addNode(startId); node.addAttribute("x", vehicle.getStartLocation().getCoordinate().getX()); node.addAttribute("y", vehicle.getStartLocation().getCoordinate().getY()); node.addAttribute("ui.class", "depot"); String endId = makeEndId(vehicle); if (!startId.equals(endId)) { Node endNode = graph.addNode(endId); endNode.addAttribute("x", vehicle.getEndLocation().getCoordinate().getX()); endNode.addAttribute("y", vehicle.getEndLocation().getCoordinate().getY()); endNode.addAttribute("ui.class", "depot"); } }
private void renderService(Graph g, Service service, Label label) { Node n = g.addNode(makeId(service.getId(), service.getLocation().getId())); if (label.equals(Label.ID)) n.addAttribute("ui.label", service.getId()); n.addAttribute("x", service.getLocation().getCoordinate().getX()); n.addAttribute("y", service.getLocation().getCoordinate().getY()); if (service.getType().equals("pickup")) n.setAttribute("ui.class", "pickup"); if (service.getType().equals("delivery")) n.setAttribute("ui.class", "delivery"); }
public void nodeAdded(String sourceId, long timeId, String nodeId) { internalGraph.addNode(nodeId); structureChanged = true; }
public void nodeAdded(String sourceId, long timeId, String nodeId) { internalGraph.addNode(nodeId); structureChanged = true; }
private void renderVehicle(Graph g, Vehicle vehicle, Label label) { String nodeId = makeId(vehicle.getId(), vehicle.getStartLocation().getId()); Node vehicleStart = g.addNode(nodeId); if (label.equals(Label.ID)) vehicleStart.addAttribute("ui.label", "depot"); // if(label.equals(Label.ACTIVITY)) n.addAttribute("ui.label", "start"); vehicleStart.addAttribute("x", vehicle.getStartLocation().getCoordinate().getX()); vehicleStart.addAttribute("y", vehicle.getStartLocation().getCoordinate().getY()); vehicleStart.setAttribute("ui.class", "depot"); if (!vehicle.getStartLocation().getId().equals(vehicle.getEndLocation().getId())) { Node vehicleEnd = g.addNode(makeId(vehicle.getId(), vehicle.getEndLocation().getId())); if (label.equals(Label.ID)) vehicleEnd.addAttribute("ui.label", "depot"); vehicleEnd.addAttribute("x", vehicle.getEndLocation().getCoordinate().getX()); vehicleEnd.addAttribute("y", vehicle.getEndLocation().getCoordinate().getY()); vehicleEnd.setAttribute("ui.class", "depot"); } }
@SuppressWarnings("unchecked") public <T extends Node> T addNode(String id) throws IdAlreadyInUseException { T n; Node sn; elementLock.lock(); n = wrappedElement.addNode(id); sn = new SynchronizedNode(this, n); synchronizedNodes.put(id, sn); elementLock.unlock(); return (T) sn; }
@SuppressWarnings("unchecked") public <T extends Node> T addNode(String id) throws IdAlreadyInUseException { T n; Node sn; elementLock.lock(); n = wrappedElement.addNode(id); sn = new SynchronizedNode(this, n); synchronizedNodes.put(id, sn); elementLock.unlock(); return (T) sn; }
private void renderShipment(Graph g, Shipment shipment, Label label, boolean renderShipments) { Node n1 = g.addNode(makeId(shipment.getId(), shipment.getPickupLocation().getId())); if (label.equals(Label.ID)) n1.addAttribute("ui.label", shipment.getId()); n1.addAttribute("x", shipment.getPickupLocation().getCoordinate().getX()); n1.addAttribute("y", shipment.getPickupLocation().getCoordinate().getY()); n1.setAttribute("ui.class", "pickup"); Node n2 = g.addNode(makeId(shipment.getId(), shipment.getDeliveryLocation().getId())); if (label.equals(Label.ID)) n2.addAttribute("ui.label", shipment.getId()); n2.addAttribute("x", shipment.getDeliveryLocation().getCoordinate().getX()); n2.addAttribute("y", shipment.getDeliveryLocation().getCoordinate().getY()); n2.setAttribute("ui.class", "delivery"); if (renderShipments) { Edge s = g.addEdge(shipment.getId(), makeId(shipment.getId(), shipment.getPickupLocation().getId()), makeId(shipment.getId(), shipment.getDeliveryLocation().getId()), true); s.addAttribute("ui.class", "shipment"); } }
public void nodeAdded(String sourceId, long timeId, String nodeId) { if (sinkTime.isNewEvent(sourceId, timeId)) { passYourWay = true; try { g.addNode(nodeId); } finally { passYourWay = false; } sendNodeAdded(sourceId, timeId, nodeId); } }
public void nodeAdded(String sourceId, long timeId, String nodeId) { if (sinkTime.isNewEvent(sourceId, timeId)) { passYourWay = true; try { g.addNode(nodeId); } finally { passYourWay = false; } sendNodeAdded(sourceId, timeId, nodeId); } }
public static void main(String... args) throws Exception { Graph g1 = new AdjacencyListGraph("g1"); Graph g2 = new AdjacencyListGraph("g2"); Node a1 = g1.addNode("A"); a1.addAttribute("attr1", "test"); a1.addAttribute("attr2", 10.0); a1.addAttribute("attr3", 12); Node a2 = g2.addNode("A"); a2.addAttribute("attr1", "test1"); a2.addAttribute("attr2", 10.0); g2.addNode("B"); g2.addNode("C"); GraphDiff diff = new GraphDiff(g2, g1); System.out.println(diff); } }
public static void main(String... args) throws Exception { Graph g1 = new AdjacencyListGraph("g1"); Graph g2 = new AdjacencyListGraph("g2"); Node a1 = g1.addNode("A"); a1.addAttribute("attr1", "test"); a1.addAttribute("attr2", 10.0); a1.addAttribute("attr3", 12); Node a2 = g2.addNode("A"); a2.addAttribute("attr1", "test1"); a2.addAttribute("attr2", 10.0); g2.addNode("B"); g2.addNode("C"); GraphDiff diff = new GraphDiff(g2, g1); System.out.println(diff); } }
private void addNode(String nodeId, Coordinate nodeCoord) { Node node = graph.addNode(nodeId); node.addAttribute("x", nodeCoord.getX()); node.addAttribute("y", nodeCoord.getY()); }
/** * Add a node and put attributes on it if needed. * * @param id * The new node identifier. */ protected void addNode(String id) { sendNodeAdded(sourceId, id); if (addNodeLabels) sendNodeAttributeAdded(sourceId, id, "label", id); if (useInternalGraph) internalGraph.addNode(id); double value; for (String attr : nodeAttributes) { value = (random.nextDouble() * (nodeAttributeRange[1] - nodeAttributeRange[0])) + nodeAttributeRange[0]; sendNodeAttributeAdded(sourceId, id, attr, value); if (useInternalGraph) internalGraph.getNode(id).addAttribute(attr, value); } }
/** * Add a node and put attributes on it if needed. * * @param id * The new node identifier. */ protected void addNode(String id) { sendNodeAdded(sourceId, id); if (addNodeLabels) sendNodeAttributeAdded(sourceId, id, "label", id); if (useInternalGraph) internalGraph.addNode(id); double value; for (String attr : nodeAttributes) { value = (random.nextDouble() * (nodeAttributeRange[1] - nodeAttributeRange[0])) + nodeAttributeRange[0]; sendNodeAttributeAdded(sourceId, id, attr, value); if (useInternalGraph) internalGraph.getNode(id).addAttribute(attr, value); } }
private void addVehicle(Vehicle vehicle) { String startId = makeStartId(vehicle); Node node = graph.addNode(startId); node.addAttribute("x", vehicle.getStartLocation().getCoordinate().getX()); node.addAttribute("y", vehicle.getStartLocation().getCoordinate().getY()); node.addAttribute("ui.class", "depot"); String endId = makeEndId(vehicle); if (!startId.equals(endId)) { Node endNode = graph.addNode(endId); endNode.addAttribute("x", vehicle.getEndLocation().getCoordinate().getX()); endNode.addAttribute("y", vehicle.getEndLocation().getCoordinate().getY()); endNode.addAttribute("ui.class", "depot"); } }
private void renderService(Graph g, Service service, Label label) { Node n = g.addNode(makeId(service.getId(), service.getLocation().getId())); if (label.equals(Label.ID)) n.addAttribute("ui.label", service.getId()); n.addAttribute("x", service.getLocation().getCoordinate().getX()); n.addAttribute("y", service.getLocation().getCoordinate().getY()); if (service.getType().equals("pickup")) n.setAttribute("ui.class", "pickup"); if (service.getType().equals("delivery")) n.setAttribute("ui.class", "delivery"); }
private void renderVehicle(Graph g, Vehicle vehicle, Label label) { String nodeId = makeId(vehicle.getId(), vehicle.getStartLocation().getId()); Node vehicleStart = g.addNode(nodeId); if (label.equals(Label.ID)) vehicleStart.addAttribute("ui.label", "depot"); // if(label.equals(Label.ACTIVITY)) n.addAttribute("ui.label", "start"); vehicleStart.addAttribute("x", vehicle.getStartLocation().getCoordinate().getX()); vehicleStart.addAttribute("y", vehicle.getStartLocation().getCoordinate().getY()); vehicleStart.setAttribute("ui.class", "depot"); if (!vehicle.getStartLocation().getId().equals(vehicle.getEndLocation().getId())) { Node vehicleEnd = g.addNode(makeId(vehicle.getId(), vehicle.getEndLocation().getId())); if (label.equals(Label.ID)) vehicleEnd.addAttribute("ui.label", "depot"); vehicleEnd.addAttribute("x", vehicle.getEndLocation().getCoordinate().getX()); vehicleEnd.addAttribute("y", vehicle.getEndLocation().getCoordinate().getY()); vehicleEnd.setAttribute("ui.class", "depot"); } }
private void renderShipment(Graph g, Shipment shipment, Label label, boolean renderShipments) { Node n1 = g.addNode(makeId(shipment.getId(), shipment.getPickupLocation().getId())); if (label.equals(Label.ID)) n1.addAttribute("ui.label", shipment.getId()); n1.addAttribute("x", shipment.getPickupLocation().getCoordinate().getX()); n1.addAttribute("y", shipment.getPickupLocation().getCoordinate().getY()); n1.setAttribute("ui.class", "pickup"); Node n2 = g.addNode(makeId(shipment.getId(), shipment.getDeliveryLocation().getId())); if (label.equals(Label.ID)) n2.addAttribute("ui.label", shipment.getId()); n2.addAttribute("x", shipment.getDeliveryLocation().getCoordinate().getX()); n2.addAttribute("y", shipment.getDeliveryLocation().getCoordinate().getY()); n2.setAttribute("ui.class", "delivery"); if (renderShipments) { Edge s = g.addEdge(shipment.getId(), makeId(shipment.getId(), shipment.getPickupLocation().getId()), makeId(shipment.getId(), shipment.getDeliveryLocation().getId()), true); s.addAttribute("ui.class", "shipment"); } }