Exemplo n.º 1
0
  private boolean containInstance(Instance sel, Slot slot, Instance instance) {
    if (itsInstance == null) return false;
    Collection instances = sel.getOwnSlotValues(slot);
    Iterator i = instances.iterator();
    while (i.hasNext()) {

      Instance tmpInstance = (Instance) i.next();
      if (tmpInstance.equals(instance)) return true;
    }
    return false;
  }
Exemplo n.º 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;
  }
Exemplo n.º 3
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;
 }