public abstract class AttributeRule<T> extends java.lang.Object implements SelectionRule, java.lang.Cloneable
AttributeRule
provides a selection mechanism for
features based on the value of one of the attributes. If a feature has an
attribute value that matches, it is considered a matching
feature. If the feature attribute value is null, the feature is
non-matching no matter what operator is used. The actual matching
operation is left to the subclass depending on the attribute type.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
matchAttName
The attribute to use for matching.
|
protected T |
matchAttValue
The attribute value to use for matching.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
nameMap
The map to use to translate name to index for attributes.
|
protected java.lang.Enum |
operator
Thee rule operator currently being used.
|
Modifier | Constructor and Description |
---|---|
protected |
AttributeRule(java.lang.String attName,
java.util.Map<java.lang.String,java.lang.Integer> nameMap,
T attValue)
Creates a new attribute rule.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
java.lang.String |
getAttribute()
Gets the attribute name for this rule.
|
java.lang.Enum |
getOperator()
Gets the current rule operator.
|
T |
getValue()
Gets the attribute value for this rule.
|
abstract java.lang.Enum[] |
operators()
Gets an array of operators that are valid for this rule.
|
void |
setAttribute(java.lang.String attName)
Sets the attribute name for this rule.
|
void |
setOperator(java.lang.Enum operator)
Sets the rule operator.
|
void |
setValue(T attValue)
Sets the attribute value for this rule.
|
java.lang.String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
matches
protected java.lang.String matchAttName
protected T matchAttValue
protected java.util.Map<java.lang.String,java.lang.Integer> nameMap
protected java.lang.Enum operator
protected AttributeRule(java.lang.String attName, java.util.Map<java.lang.String,java.lang.Integer> nameMap, T attValue)
attName
- the attribute name to use for matching.nameMap
- the name to index mapping for attributes.attValue
- the attribute value to use for matching.java.lang.RuntimeException
- if the attribute name has no valid mapping
to an index.public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String getAttribute()
public void setAttribute(java.lang.String attName)
attName
- the attribute name to use for matching.java.lang.RuntimeException
- if the attribute name has no valid mapping
to an index.public T getValue()
public void setValue(T attValue)
attValue
- the attribute value to use for matching.public abstract java.lang.Enum[] operators()
public java.lang.Enum getOperator()
public void setOperator(java.lang.Enum operator)
operator
- the new rule operator.public java.lang.String toString()
toString
in class java.lang.Object