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
 private boolean testInstance(int testIndex, Instance instance, Slot slot) {
   String value;
   if (specification.getValue() == null) return false;
   if (((String) specification.getValue()).length() < 1) return false;
   value = instance.getBrowserText();
   return testInstance(testIndex, instance, slot, value);
 }
Exemplo n.º 3
0
  /** Main test subroutine for Instance slot. */
  private boolean testInstance(int testIndex, Instance instance, Slot slot, String value) {

    boolean testResult = false;
    if (instance == null) return testResult;
    if (slot == null) {
      return false;
    }

    Instance tmpInstance = (Instance) instance.getOwnSlotValue(slot);
    if (tmpInstance == null && testIndex == 0) return false;
    if (tmpInstance == null && testIndex == 1) return true;

    switch (testIndex) {
      case 0: // is equal to
        return containInstance(instance, slot, itsInstance);
      case 1: // is not equal to
        return (!containInstance(instance, slot, itsInstance));
      default:
        break;
    }
    return testResult;
  }