示例#1
0
  protected Boolean containsInternal(Object o) {
    if (individuals.contains(o)) {
      return Boolean.TRUE;
    }

    for (Iterator iter = popAppSatisfiers.entrySet().iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      NumberVar popApp = (NumberVar) entry.getKey();
      ObjectSet satisfiers = (ObjectSet) entry.getValue();
      if (satisfiers.contains(o)) {
        Set exceptions = (Set) popAppExceptions.get(popApp);
        return Boolean.valueOf(!exceptions.contains(o));
      }
    }

    return Boolean.FALSE;
  }
示例#2
0
  public int indexOf(Object o) {
    int indivIndex = individuals.indexOf(o);
    if (indivIndex != -1) {
      return indivIndex;
    }

    int indexSoFar = individuals.size();
    for (Iterator iter = popAppSatisfiers.entrySet().iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      NumberVar popApp = (NumberVar) entry.getKey();
      ObjectSet satisfiers = (ObjectSet) entry.getValue();
      Set exceptions = (Set) popAppExceptions.get(popApp);

      if (satisfiers.contains(o) && !exceptions.contains(o)) {
        return (indexSoFar + getIndexInPOPApp(satisfiers, exceptions, o));
      }

      int numInSet = satisfiers.size() - exceptions.size();
      indexSoFar += numInSet;
    }

    return -1;
  }