Esempio n. 1
0
 /** @return canonical AccessPath object */
 public AccessPath findOrCreate(PathElement initialElement) {
   APKey k = new APKey(initialElement);
   AccessPath result = map.get(k);
   if (result == null) {
     int id = vector.getMaxIndex() + 1;
     result = new AccessPath(k, id);
     map.put(k, result);
     vector.set(id, result);
     findOrCreateStartsWith(initialElement).add(id);
   }
   return result;
 }
Esempio n. 2
0
 /**
  * @param elements List<PathElement>
  * @return canonical AccessPath object
  */
 public AccessPath findOrCreate(List<PathElement> elements) {
   if (PARANOID) {
     for (Iterator<PathElement> it = elements.iterator(); it.hasNext(); ) {
       if (!(it.next() instanceof PathElement)) {
         Assertions.UNREACHABLE();
       }
     }
   }
   APKey k = new APKey(elements);
   AccessPath result = map.get(k);
   if (result == null) {
     int id = vector.getMaxIndex() + 1;
     result = new AccessPath(k, id);
     map.put(k, result);
     vector.set(id, result);
     findOrCreateStartsWith(result.getHead()).add(id);
   }
   return result;
 }