private void markRemoved(Node node) { node.setAttribute("ui.class", "removed"); }
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"); }
/** * Set the distance value of the given node. * * @param node * The node to modify. * @param distance * The delta value to store on the node. */ protected void setDistance(Node node, double distance) { node.setAttribute(distAttributeName, distance); }
/** * Set the distance value of the given node. * * @param node * The node to modify. * @param distance * The delta value to store on the node. */ protected void setDistance(Node node, double distance) { node.setAttribute(distAttributeName, distance); }
/** * Set the sigma value of the given node. * * @param node * The node to modify. * @param sigma * The sigma value to store on the node. */ protected void setSigma(Node node, double sigma) { node.setAttribute(sigmaAttributeName, sigma); }
/** * Set the delta value of the given node. * * @param node * The node to modify. * @param delta * The delta value to store on the node. */ protected void setDelta(Node node, double delta) { node.setAttribute(deltaAttributeName, delta); }
/** * Remove all predecessors of the given node. * * @param node * Remove all predecessors of this node. */ protected void clearPredecessorsOf(Node node) { HashSet<Node> set = new HashSet<Node>(); node.setAttribute(predAttributeName, set); }
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"); } }
@Override protected void originateCommunity(Node node) { super.originateCommunity(node); node.setAttribute(marker + ".score", 0.0); } }
void registerNode(Node n) { ConnectedComponent old = componentsMap.put(n, this); if (countAttribute != null) { n.setAttribute(countAttribute, id); } if (old != this) { size++; if (old != null) { old.unregisterNode(n); } } }
@Override protected void originateCommunity(Node node) { super.originateCommunity(node); // Correct the original community score for the Leung algorithm node.setAttribute(marker + ".score", 1.0); } }
@Override protected void originateCommunity(Node node) { super.originateCommunity(node); node.setAttribute(marker + ".score", 0.0); } }
// let n be the clicked node... Iterator<Node> it = n.getBreadthFirstIterator(true); while(it.hasNext()){ Node m = it.next(); for(Edge e : m.getLeavingEdgeSet()) { e.setAttribute("ui.hide"); } if(n != m) { m.setAttribute("ui.hide"); } }
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"); } }
void scale(double sx, double sy) { width *= sx; height *= sy; for (int i = 0; i < size(); i++) { get(i).setAttribute("x", sx * get(i).getNumber("x")); get(i).setAttribute("y", sy * get(i).getNumber("y")); } }
void translate(double dx, double dy) { for (int i = 0; i < size(); i++) { get(i).setAttribute("x", dx + get(i).getNumber("x")); get(i).setAttribute("y", dy + get(i).getNumber("y")); } } }
void translate(double dx, double dy) { for (int i = 0; i < size(); i++) { get(i).setAttribute("x", dx + get(i).getNumber("x")); get(i).setAttribute("y", dy + get(i).getNumber("y")); } } }
/** * Apply evaporation on each edge. */ protected void evaporate() { for(Edge edge: context.graph.getEachEdge()) { edge.setAttribute(context.passesAttribute, edge.getNumber(context.passesAttribute)*evaporation); } for(Node node: context.graph) { node.setAttribute(context.passesAttribute, node.getNumber(context.passesAttribute)*evaporation); } }
/** * Apply evaporation on each edge. */ protected void evaporate() { for(Edge edge: context.graph.getEachEdge()) { edge.setAttribute(context.passesAttribute, edge.getNumber(context.passesAttribute)*evaporation); } for(Node node: context.graph) { node.setAttribute(context.passesAttribute, node.getNumber(context.passesAttribute)*evaporation); } }
protected void setBox(Box box, Node node) { if (node.hasAttribute("box")) getBox(node).remove(node); box.add(node); node.setAttribute("box", box); if (!node.hasAttribute("children")) node.addAttribute("children", new Box(node, 1)); getChildrenBox(node).level = box.level + 1; }