Example #1
0
  private List<ObjectInstance> objectsMatchingClass(List<ObjectInstance> sourceObs, String cname) {

    List<ObjectInstance> res = new ArrayList<ObjectInstance>(sourceObs.size());

    for (ObjectInstance o : sourceObs) {

      if (o.getTrueClassName().equals(cname)) {
        res.add(o);
      }
    }

    return res;
  }
Example #2
0
  private void removeObjectClassIndexing(ObjectInstance o) {

    String otclass = o.getTrueClassName();
    List<ObjectInstance> classTList = objectIndexByTrueClass.get(otclass);

    // if this index has more than one entry, then we can just remove from it and be done
    if (classTList.size() > 1) {
      classTList.remove(o);
    } else {
      // otherwise we have to remove class entries for it
      objectIndexByTrueClass.remove(otclass);
    }
  }
Example #3
0
  private void addObjectClassIndexing(ObjectInstance o) {

    String otclass = o.getTrueClassName();

    // manage true indexing
    if (objectIndexByTrueClass.containsKey(otclass)) {
      objectIndexByTrueClass.get(otclass).add(o);
    } else {

      ArrayList<ObjectInstance> classList = new ArrayList<ObjectInstance>();
      classList.add(o);
      objectIndexByTrueClass.put(otclass, classList);
    }
  }