Link getLinkFromNode(Node fromNode) { if (!fromNodes.containsKey(fromNode)) { fromNodes.put(fromNode, getNewLink(fromNode, myNode)); } return fromNodes.get(fromNode); }
Link getLinkToNode(Node toNode) { if (!toNodes.containsKey(toNode)) { toNodes.put(toNode, getNewLink(myNode, toNode)); } return toNodes.get(toNode); }
List<Link> getLinks() { List<Link> links = new ArrayList<>(); links.addAll(fromNodes.values()); links.addAll(toNodes.values()); return links; }