/** Overridden in Drop/Keep as appropriate. Answer true if the object is to be kept in the output, false if it is to be dropped. */ protected boolean accept( T x ) { return f.accept( x ); }
public Filter<T> and( final Filter<T> other ) { return other.isAny() ? this : new Filter<T>() { @Override public boolean accept( T x ) { return Filter.this.accept( x ) && other.accept( x ); } }; }
/** @see com.hp.hpl.jena.mem.Temp#iterateAll(com.hp.hpl.jena.graph.Triple) */ public ExtendedIterator<Triple> iterateAll( Triple pattern ) { return indexField.filterOn( pattern ) .and( f2.filterOn( pattern ) ) .and( f3.filterOn( pattern ) ) .filterKeep( iterateAll() ) ; }
@Override public ExtendedIterator<Triple> iterator( Node index, Node n2, Node n3 ) { TripleBunch s = bunchMap.get( index.getIndexingValue() ); return s == null ? NullIterator.<Triple>instance() : f2.filterOn( n2 ).and( f3.filterOn( n3 ) ) .filterKeep( s.iterator() ) ; }
/** Answer an iterator over all the triples in this NTM which match <code>pattern</code>. The index field of this NTM is guaranteed concrete in the pattern. */ @Override public ExtendedIterator<Triple> iterator( Node index, Node n2, Node n3 ) { Object indexValue = index.getIndexingValue(); TripleBunch s = bunchMap.get( indexValue ); // System.err.println( ">> ntmf::iterator: " + (s == null ? (Object) "None" : s.getClass()) ); return s == null ? NullIterator.<Triple>instance() : f2.filterOn( n2 ).and( f3.filterOn( n3 ) ) .filterKeep( s.iterator( new NotifyMe( indexValue ) ) ) ; }
@Override public boolean accept(Triple t) { return !filter.accept(t) ; }
@Override protected boolean accept( T x ) { return !f.accept( x ); } }
@Override protected boolean accept( T x ) { return f.accept( x ); } }
/** * Creates and adds the triple to the given list if the triple passes * the filter. * * @param triples List to be added * @param s subject of the triple * @param p predicate of the triple * @param o object of the triple */ private void addTriple(List<Triple> triples, Node s, Node p, Node o) { Triple triple = Triple.create( s, p, o ); if( !filter.accept( triple ) ) triples.add( triple ); }