/** {@inheritDoc} */
 @Override
 public QueryResult deleteQueryResult(final QueryResult queryResult, final int operandID) {
   final Iterator<Bindings> itb = queryResult.oneTimeIterator();
   while (itb.hasNext()) {
     this.bindings.remove(itb.next());
   }
   return null;
 }
Пример #2
0
 /** {@inheritDoc} */
 @Override
 public QueryResult deleteQueryResult(final QueryResult queryResult, final int operandID) {
   // problem: it does not count the number of occurrences of a binding
   // i.e. { ?a=<a> }, { ?a=<a> } and delete { ?a=<a> } will result in
   // {} instead of { ?a=<a> }!!!!!!
   final Iterator<Bindings> itb = queryResult.oneTimeIterator();
   while (itb.hasNext()) {
     this.bindings.remove(itb.next());
   }
   return null;
 }
Пример #3
0
  /** {@inheritDoc} */
  @Override
  public QueryResult process(final QueryResult _bindings, final int operandID) {
    final Iterator<Bindings> itb = _bindings.oneTimeIterator();
    if (!itb.hasNext()) {
      return null;
    } else {
      return QueryResult.createInstance(
          new ImmutableIterator<Bindings>() {
            Bindings next = null;

            @Override
            public boolean hasNext() {
              if (this.next != null) {
                return true;
              }
              if (itb.hasNext()) {
                this.next = this.next();
                if (this.next != null) {
                  return true;
                }
              }
              return false;
            }

            @Override
            public Bindings next() {
              if (this.next != null) {
                final Bindings znext = this.next;
                this.next = null;
                return znext;
              }
              while (itb.hasNext()) {
                final Bindings b = itb.next();
                if (!NonBlockingDistinct.this.bindings.contains(b)) {
                  NonBlockingDistinct.this.bindings.add(b);
                  return b;
                }
              }
              return null;
            }
          });
    }
  }