private Node fetchNode(Graph g, Object2LongOpenHashMap<Instance> mapping, Instance inst) { if (mapping.containsKey(inst)) { return g.getNode(mapping.getLong(inst)); } return createNode(g, mapping, inst); }
private Node createNode(Graph g, Object2LongOpenHashMap<Instance> mapping, Instance inst) { Node node = g.getFactory().newNode(inst); mapping.put(inst, node.getId()); g.addNode(node); return node; }