private void markEdgeRemoved(String edgeId) { graph.getEdge(edgeId).addAttribute("ui.class", "removed"); }
private void markEdgeInserted(String edgeId) { graph.getEdge(edgeId).addAttribute("ui.class", "inserted"); graph.getEdge(edgeId).removeAttribute("ui.class"); }
private void addJob(Job job) { if (job instanceof Service) { Service service = (Service) job; addNode(service.getId(), service.getLocation().getCoordinate()); markService(service); } else if (job instanceof Shipment) { Shipment shipment = (Shipment) job; String fromNodeId = getFromNodeId(shipment); addNode(fromNodeId, shipment.getPickupLocation().getCoordinate()); String toNodeId = getToNodeId(shipment); addNode(toNodeId, shipment.getDeliveryLocation().getCoordinate()); markShipment(shipment); if (renderShipments) { Edge e = graph.addEdge("shipment_" + fromNodeId + "_" + toNodeId, fromNodeId, toNodeId, true); e.addAttribute("ui.class", "shipment"); } } }
@Override public void edgeAdded(String graphId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed) { Edge edge = context.graph.getEdge(edgeId); if (edge != null) edge.addAttribute(context.passesAttribute, 0.0); }
@Override public void edgeAdded(String graphId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed) { Edge edge = context.graph.getEdge(edgeId); if (edge != null) edge.addAttribute(context.passesAttribute, 0.0); }
private void markEdgeRemoved(String edgeId) { graph.getEdge(edgeId).addAttribute("ui.class", "removed"); }
protected void equipGraph() { for (Edge e : context.graph.getEachEdge()) { e.addAttribute(context.passesAttribute, 0.0); } for (Node n : context.graph) { n.addAttribute(context.passesAttribute, 0.0); } }
protected void equipGraph() { for (Edge e : context.graph.getEachEdge()) { e.addAttribute(context.passesAttribute, 0.0); } for (Node n : context.graph) { n.addAttribute(context.passesAttribute, 0.0); } }
private void markEdgeInserted(String edgeId) { graph.getEdge(edgeId).addAttribute("ui.class", "inserted"); graph.getEdge(edgeId).removeAttribute("ui.class"); }
public void edgeAttributeAdded(String sourceId, long timeId, String edgeId, String attribute, Object value) { if (sinkTime.isNewEvent(sourceId, timeId)) { Edge edge = g.getEdge(edgeId); if (edge != null) { passYourWay = true; try { edge.addAttribute(attribute, value); } finally { passYourWay = false; } sendEdgeAttributeAdded(sourceId, timeId, edgeId, attribute, value); } } }
public void edgeAttributeAdded(String sourceId, long timeId, String edgeId, String attribute, Object value) { if (sinkTime.isNewEvent(sourceId, timeId)) { Edge edge = g.getEdge(edgeId); if (edge != null) { passYourWay = true; try { edge.addAttribute(attribute, value); } finally { passYourWay = false; } sendEdgeAttributeAdded(sourceId, timeId, edgeId, attribute, value); } } }
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"); } }
/** * Sets the label and the {@code "ui.class"} attribute of the edge (or * node if the arc is artificial) of the original graph corresponding to * this arc. */ void setUIClass() { if (isArtificial()) { NSNode node = getOpposite(root); String uiClass = "trans"; if (node.supply > 0) uiClass = "supply"; else if (node.supply < 0) uiClass = "demand"; uiClass += flow == 0 ? "_balanced" : "_unbalanced"; Node x = graph.getNode(node.id); x.addAttribute("label", target == root ? flow : -flow); x.addAttribute("ui.class", uiClass); } else { String uiClass = "basic"; if (status == ArcStatus.NONBASIC_LOWER) uiClass = "nonbasic_lower"; else if (status == ArcStatus.NONBASIC_UPPER) uiClass = "nonbasic_upper"; Edge e = graph.getEdge(getOriginalId()); e.addAttribute("label", flow); e.addAttribute("ui.class", uiClass); } }
/** * Sets the label and the {@code "ui.class"} attribute of the edge (or * node if the arc is artificial) of the original graph corresponding to * this arc. */ void setUIClass() { if (isArtificial()) { NSNode node = getOpposite(root); String uiClass = "trans"; if (node.supply > 0) uiClass = "supply"; else if (node.supply < 0) uiClass = "demand"; uiClass += flow == 0 ? "_balanced" : "_unbalanced"; Node x = graph.getNode(node.id); x.addAttribute("label", target == root ? flow : -flow); x.addAttribute("ui.class", uiClass); } else { String uiClass = "basic"; if (status == ArcStatus.NONBASIC_LOWER) uiClass = "nonbasic_lower"; else if (status == ArcStatus.NONBASIC_UPPER) uiClass = "nonbasic_upper"; Edge e = graph.getEdge(getOriginalId()); e.addAttribute("label", flow); e.addAttribute("ui.class", uiClass); } }
/** * Set the name of the attribute used to store the number of passes of each * entity on each edge or node. * * @param name * A string giving the passes name. */ public void setPassesAttribute(String name) { if (context.graph != null) { for (Edge e : context.graph.getEachEdge()) { e.addAttribute(name, e.getNumber(context.passesAttribute)); e.removeAttribute(context.passesAttribute); } for (Node n : context.graph) { n.addAttribute(name, n.getNumber(context.passesAttribute)); n.removeAttribute(context.passesAttribute); } } context.passesAttribute = name; }
/** * Set the name of the attribute used to store the number of passes of each * entity on each edge or node. * * @param name * A string giving the passes name. */ public void setPassesAttribute(String name) { if (context.graph != null) { for (Edge e : context.graph.getEachEdge()) { e.addAttribute(name, e.getNumber(context.passesAttribute)); e.removeAttribute(context.passesAttribute); } for (Node n : context.graph) { n.addAttribute(name, n.getNumber(context.passesAttribute)); n.removeAttribute(context.passesAttribute); } } context.passesAttribute = name; }
private void addJob(Job job) { if (job instanceof Service) { Service service = (Service) job; addNode(service.getId(), service.getLocation().getCoordinate()); markService(service); } else if (job instanceof Shipment) { Shipment shipment = (Shipment) job; String fromNodeId = getFromNodeId(shipment); addNode(fromNodeId, shipment.getPickupLocation().getCoordinate()); String toNodeId = getToNodeId(shipment); addNode(toNodeId, shipment.getDeliveryLocation().getCoordinate()); markShipment(shipment); if (renderShipments) { Edge e = graph.addEdge("shipment_" + fromNodeId + "_" + toNodeId, fromNodeId, toNodeId, true); e.addAttribute("ui.class", "shipment"); } } }
e.addAttribute(key, edge.getAttribute(key));
e.addAttribute(key, edge.getAttribute(key));
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"); } }