org.hd.d.pg2k.webSvr.exhibit
Class FilterExpr

java.lang.Object
  extended by org.hd.d.pg2k.webSvr.exhibit.Expr
      extended by org.hd.d.pg2k.webSvr.exhibit.FilterExpr
All Implemented Interfaces:
java.io.Serializable

public final class FilterExpr
extends Expr

Wraps a filter to make an expression (for a FilterBean). Filters must be Serializable so that filter expressions can be persisted. They must not attempt to cache any reference, direct or indirect, to the DataSourceBean.

Filter objects must be immutable and the accept() method must be idempotent and not depend on any state held within the object.

TODO: do object validation on deserialisation

See Also:
Serialized Form

Field Summary
private  FilterIF filter
          The filter we apply here; never null.
private static int MIN_SIZE_FOR_CONCURRENCY
          Minimum number of values worth attempting to filter in parallel; strictly positive.
private static long serialVersionUID
          Unique Serialisation class ID generated by http://random.hd.org/.
 
Constructor Summary
FilterExpr(Expr _upstream, FilterIF _filter)
          Construct us with the upstream expression.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Equality depends on underlying expression and this filter.
 Name.ExhibitFull[] eval(AllExhibitProperties aep, Name.ExhibitFull[] in)
          Evaluate this expression applying our filter.
 int hashCode()
          Hash depends on underlying expression and this filter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

private final FilterIF filter
The filter we apply here; never null.


MIN_SIZE_FOR_CONCURRENCY

private static final int MIN_SIZE_FOR_CONCURRENCY
Minimum number of values worth attempting to filter in parallel; strictly positive. This plays off parallelism overhead vs available concurrency but should not be especially critical an order of magnitude either way.

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/.

See Also:
Constant Field Values
Constructor Detail

FilterExpr

public FilterExpr(Expr _upstream,
                  FilterIF _filter)
Construct us with the upstream expression. If the upstream expression is null this is the first element in the expression pipeline.

Method Detail

eval

public Name.ExhibitFull[] eval(AllExhibitProperties aep,
                               Name.ExhibitFull[] in)
Evaluate this expression applying our filter. Given the upstream expression, compute its results and then compute ours on it.

We return a set of names, possibly empty.

The result array contains no duplicates nor nulls (providing the input is similarly well-behaved) and is never null itself.

Designed to be overridden and have super() called to collect upstream results... By itself returns all the exhibits untouched, ie is a null filter/sorter.

Will attempt to filter in parallel if possible...

Overrides:
eval in class Expr

hashCode

public int hashCode()
Hash depends on underlying expression and this filter.

Overrides:
hashCode in class Expr

equals

public boolean equals(java.lang.Object obj)
Equality depends on underlying expression and this filter.

Overrides:
equals in class Expr

DHD Multimedia Gallery V1.60.69

Copyright (c) 1996-2012, Damon Hart-Davis. All rights reserved.