Class AttributeRule<T>

java.lang.Object
noaa.coastwatch.render.feature.AttributeRule<T>
All Implemented Interfaces:
Cloneable, SelectionRule
Direct Known Subclasses:
DateRule, NumberRule, TextRule, TimeWindowRule

public abstract class AttributeRule<T> extends Object implements SelectionRule, Cloneable
An 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.
Since:
3.3.2
Author:
Peter Hollemans
  • Field Details

    • matchAttName

      protected String matchAttName
      The attribute to use for matching.
    • matchAttValue

      protected T matchAttValue
      The attribute value to use for matching.
    • nameMap

      protected Map<String,Integer> nameMap
      The map to use to translate name to index for attributes.
    • operator

      protected Enum operator
      Thee rule operator currently being used.
  • Constructor Details

    • AttributeRule

      protected AttributeRule(String attName, Map<String,Integer> nameMap, T attValue)
      Creates a new attribute rule.
      Parameters:
      attName - the attribute name to use for matching.
      nameMap - the name to index mapping for attributes.
      attValue - the attribute value to use for matching.
      Throws:
      RuntimeException - if the attribute name has no valid mapping to an index.
  • Method Details

    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • getAttribute

      public String getAttribute()
      Gets the attribute name for this rule.
      Returns:
      the attribute name used by this rule for matching.
    • setAttribute

      public void setAttribute(String attName)
      Sets the attribute name for this rule.
      Parameters:
      attName - the attribute name to use for matching.
      Throws:
      RuntimeException - if the attribute name has no valid mapping to an index.
    • getValue

      public T getValue()
      Gets the attribute value for this rule.
      Returns:
      the attribute value used by this rule for matching.
    • setValue

      public void setValue(T attValue)
      Sets the attribute value for this rule.
      Parameters:
      attValue - the attribute value to use for matching.
    • operators

      public abstract Enum[] operators()
      Gets an array of operators that are valid for this rule.
      Returns:
      the array of valid operators.
    • getOperator

      public Enum getOperator()
      Gets the current rule operator.
      Returns:
      the current operator.
    • setOperator

      public void setOperator(Enum operator)
      Sets the rule operator.
      Parameters:
      operator - the new rule operator.
    • toString

      public String toString()
      Overrides:
      toString in class Object