|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.dispatch.Filter
A specification for an event class.
Each Filter
consists of a set of restrictions, the
intersection of which describe the set of QueueElementIF
events objects which satisfy the Filter
.
Field Summary | |
---|---|
double |
acceptance_rate
The fraction of qualifying events which the Classifier
should pass through the Filter .
|
LinkedList |
ordered_restrictions
A List containing all the restrictions in the order
they were added. |
Class |
required_type
The most recently required type. |
HashMap |
restrictions
A HashMap containing all the restrictions for this
Filter .
|
protected static HashMap |
valid_types
A HashMap containing the set of valid types for fields
whose value we would like to restrict.
|
Constructor Summary | |
---|---|
Filter()
|
Method Summary | |
---|---|
boolean |
requireType(Class type)
Add a type restriction. |
boolean |
requireType(String type_name)
Add a type restriction. |
boolean |
requireValue(Field field,
Object value)
Add a restriction of a field's value. |
boolean |
requireValue(String field_name,
Object value)
Add a restriction of a field's value. |
boolean |
setAcceptanceRate(double rate)
Name the fraction of qualifying events which the Classifier should pass through the Filter . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static HashMap valid_types
HashMap
containing the set of valid types for fields
whose value we would like to restrict.
If the type is a Java primitive wrapper, it maps to the
Class
object for the associated primitive.
Update this HashMap (through the static initializer) if you want to
add an allowable type restriction.
NOTE all added types should override the default
hashCode
method with their own deterministic version.
public double acceptance_rate
Classifier
should pass through the Filter
.
Must be between 0 and 1, inclusive.
Use this variable if we want to sample the event stream.
public HashMap restrictions
HashMap
containing all the restrictions for this
Filter
.
The key is a Field
object, mapped to the value
which the Field
should have.
public LinkedList ordered_restrictions
List
containing all the restrictions in the order
they were added.
public Class required_type
Class
must be the
most restrictive one mentioned, so we can forget all previous
requireType
calls and store just the last one.
Constructor Detail |
public Filter()
Method Detail |
public boolean requireType(String type_name)
Class
and calls
requireType( Class )
.
type_name
- The name of the Class
of which filtered
QueueElementIF
s must be a member.
true
iff the requirement was registered without
errors.public boolean requireType(Class type)
QueueElementIF
objects must now be members of the
specified class, or they will not pass the filter.
The class must be a subclass of all classes required so far, which
makes sense.
type
- The Class
of which filtered
QueueElementIF
s must be a member.
true
iff the requirement was registered without
errors.public boolean requireValue(String field_name, Object value)
Field
and calls
requireValue( Field, Object )
.
field_name
- The name of the Field
whose value
we are restricting.value
- The desired value.
true
iff the requirement was registered without
errors.public boolean requireValue(Field field, Object value)
Field
of the events must
match the specified value
, or it will not pass the filter.
field
- The Field
whose value we are restricting.
It must be a member of the most recently specified
Class
.value
- The desired value. It must be of the same type as the
specified Field
, or the appropriate
wrapper if the Field
is a primitive.
Currently only simple types are allowed, such as
Integer, GUID, String, etc.
true
iff the requirement was registered without
errors.public boolean setAcceptanceRate(double rate)
Classifier
should pass through the Filter
.
true
iff the rate was set without errors.public String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |