public static ConnectionID creteConnectionId(String sourceId, String targetId, int number) { ID source = IdUtil.parseId(sourceId); ID target = IdUtil.parseId(targetId); if (source == null || target == null) { throw new IllegalArgumentException( "Id " + (source == null ? sourceId : targetId) + " is invalid."); } return new ConnectionID( CONNECTION_TYPE, createConnectionIdName(source, target), number, source.number, target.number); }
@Override protected void registerNode(Node node) { super.registerNode(node); String name = IdUtil.parseId(node.getId()).name; Set<Node> set = nodesFromName.get(name); if (set == null) { set = new HashSet<Node>(); nodesFromName.put(name, set); } set.add(node); }
@Override protected void unregisterNode(Node node) { super.unregisterNode(node); String name = IdUtil.parseId(node.getId()).name; Set<Node> set = nodesFromName.get(name); if (set != null) { set.remove(node); if (set.isEmpty()) { nodesFromName.remove(name); } } }
public static ID createTypeId(Type type) { return IdUtil.createClassId(type.getName()); }