+ // add shared locations
+ Set<HNode> sharedNodeSet = mapSharedNodeToTripleItem.keySet();
+ for (Iterator iterator = sharedNodeSet.iterator(); iterator.hasNext();) {
+ HNode sharedNode = (HNode) iterator.next();
+ TripleItem item = mapSharedNodeToTripleItem.get(sharedNode);
+ String nonSharedLocName = mapIntermediateLoc.get(item);
+ System.out.println("sharedNode=" + sharedNode + " locName=" + nonSharedLocName);
+
+ String newLocName;
+ if (locSummary.getHNodeNameSetByLatticeLoationName(nonSharedLocName) != null
+ && !lattice.isSharedLoc(nonSharedLocName)) {
+ // need to generate a new shared location in the lattice, which is one level lower than the
+ // 'locName' location
+ newLocName = "ILOC" + (LocationInference.locSeed++);
+
+ // Set<String> aboveElementSet = getAboveElementSet(lattice, locName);
+ Set<String> belowElementSet = new HashSet<String>();
+ belowElementSet.addAll(lattice.get(nonSharedLocName));
+
+ System.out.println("nonSharedLocName=" + nonSharedLocName + " belowElementSet="
+ + belowElementSet + " newLocName=" + newLocName);
+
+ lattice.insertNewLocationBetween(nonSharedLocName, belowElementSet, newLocName);
+ } else {
+ newLocName = nonSharedLocName;
+ }
+
+ lattice.addSharedLoc(newLocName);
+ HierarchyGraph graph = infer.getSimpleHierarchyGraph(desc);
+ Set<Descriptor> descSet = graph.getDescSetOfNode(sharedNode);
+ for (Iterator iterator2 = descSet.iterator(); iterator2.hasNext();) {
+ Descriptor d = (Descriptor) iterator2.next();
+ locSummary.addMapHNodeNameToLocationName(d.getSymbol(), newLocName);
+ }
+ locSummary.addMapHNodeNameToLocationName(sharedNode.getName(), newLocName);
+
+ }
+