예제 #1
0
  public <V extends ConceptComponent<?, ?>.Version> List<V> locateLatest(
      List<V> parts, ViewCoordinate vc) throws IOException {
    V latest = null;
    OpenBitSet resultsPartSet = new OpenBitSet(parts.size());
    for (PositionBI pos : vc.getPositionSet()) {
      RelativePositionComputerBI mapper = RelativePositionComputer.getComputer(pos);
      OpenBitSet iteratorPartSet = new OpenBitSet(parts.size());
      for (int i = 0; i < parts.size(); i++) {
        V part = parts.get(i);
        if (mapper.onRoute(part)) {
          if (latest == null) {
            latest = part;
            iteratorPartSet.set(i);
          } else {
            switch (mapper.relativePosition(latest, part)) {
              case BEFORE:
                // nothing to do
                break;

              case CONTRADICTION:
                iteratorPartSet.set(i);
                break;

              case AFTER:
                latest = part;
                iteratorPartSet.clear(0, Integer.MAX_VALUE);
                iteratorPartSet.set(i);
                break;

              default:
                break;
            }
          }
        }
      }
      resultsPartSet.or(iteratorPartSet);
    }
    List<V> resultsList = new ArrayList<>((int) resultsPartSet.cardinality());
    DocIdSetIterator resultsItr = resultsPartSet.iterator();
    int id = resultsItr.nextDoc();
    while (id != DocIdSetIterator.NO_MORE_DOCS) {
      resultsList.add(parts.get(id));
      id = resultsItr.nextDoc();
    }
    return resultsList;
  }
예제 #2
0
 public void clear() {
   bitset.clear(0, bitset.size());
 }