Пример #1
0
 // This is used for Query test
 public Collection search(Collection instances, Slot slot, String operation, Object obj) {
   ArrayList resultInstances = new ArrayList();
   Iterator i = instances.iterator();
   String value = (String) (((Instance) obj).getBrowserText());
   while (i.hasNext()) {
     Instance instance = (Instance) i.next();
     if (testInstance(getTestIndex(operation), instance, slot, value))
       resultInstances.add(instance);
   }
   return resultInstances;
 }
Пример #2
0
  public Collection search() {
    if (specification.getType() == null) return null;
    String slotType = specification.getType();
    if (!slotType.toLowerCase().equals("cls")) return null;

    // Here we first test the function based on the simplest Instance cases
    ArrayList resultInstances = new ArrayList();
    Collection instances = itsInstances;
    Iterator i = instances.iterator();
    Slot slot = itsWidget.getKB().getSlot(specification.getName());
    while (i.hasNext()) {
      Instance instance = (Instance) i.next();
      if (testInstance(getTestIndex(specification.getConstraint()), instance, slot))
        resultInstances.add(instance);
    }
    return resultInstances;
  }