Class Condition

  • java.lang.Object
  • All Implemented Interfaces:
    Direct Known Subclasses:
    ConditionList, OpenCondition, SimpleCondition, TrueCondition

    public abstract class Condition
    extends java.lang.Object
    implements ConditionConstants,,
    The Condition class is an abstract class that is used to describe a boolean condition. It has several subclasses that can be combined to form complex expressions. There are public methods that can be used to help convert to and from XML format. The class can also be used to evaluate the condition.
    See Also:
    Serialized Form
    • Field Detail

    • Constructor Detail

      • Condition

        public Condition()
        Default constructor.
    • Method Detail

      • getObjectSize

        public long getObjectSize()
        Returns the estimated footprint size in bytes of this object and the objects it contains.
        Specified by:
        getObjectSize in interface
        the estimated footprint size in bytes or -1 if a size cannot be determined.
      • clone

        public abstract java.lang.Object clone()
        Returns a clone of this condition object.
        clone in class java.lang.Object
        A clone of this condition object.
      • getType

        public int getType()
        Gets the condition type. This type will be equal to one of the following constants: TRUE_CONDITION, OR_LIST_CONDITION, AND_LIST_CONDITION, SIMPLE_CONDITION or OPEN_CONDITION
      • getNot

        public boolean getNot()
        Returns true if the condition should have the boolean "NOT" operator applied to the condition.
      • setNot

        public void setNot(boolean not)
        Sets the "NOT" attribute of the condition. If this is set to true, then it indicates that the boolean "NOT" operator should be applied to the condition.
        not - Indicates if the NOT operator should be applied.
      • evaluate

        public abstract boolean evaluate(Evaluator evaluator)
        This abstract method must be implemented by subclasses of this class. Passing an appropriate implementation of the Evaluator interface to this condition will result in the condition being evaluated. The result will indicate if the condition evaluates to true or false.
        evaluator - Used to evaluate instances of SimpleCondition and OpenCondition.
        true if the condition evaluates to true.
      • getXMLFragment

        public java.lang.String getXMLFragment(java.lang.String indent)
        Gets an XML fragment that describes this condition. The XML document will conform to the following DTD fragment:

        <!ELEMENT orListCondition (not?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition)+)>
        <!ELEMENT andListCondition (not?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition)+)>
        <!ELEMENT simpleCondition (not?, variable, operator, value, qualifier*)>
        <!ELEMENT openCondition (not?, parameter*)>
        <!ATTLIST openCondition name CDATA #REQUIRED>
        <!ELEMENT trueCondition (not?)>
        <!ELEMENT not EMPTY>
        <!ELEMENT variable EMPTY>
        <!ATTLIST variable name CDATA #REQUIRED>
        <!ELEMENT operator EMPTY>
        <!ATTLIST operator name CDATA #REQUIRED>
        <!ELEMENT value EMPTY>
        <!ATTLIST value data CDATA #REQUIRED>
        <!ELEMENT qualifier EMPTY>
        <!ATTLIST qualifier name CDATA #REQUIRED>
        <!ATTLIST qualifier data CDATA #REQUIRED>
        <!ELEMENT parameter (parameter*)>
        <!ATTLIST parameter name CDATA #REQUIRED>
        <!ATTLIST parameter value CDATA #REQUIRED>

        indent - A string of whitespace that is prefixed to each line of XML produced by this method.
        An XML fragment representing this condition.
      • loadConditionFromXML

        public static Condition loadConditionFromXML(org.w3c.dom.Element element)
        Loads a condition object from an XML element object.
        element - An XML Element object.
        A condition object that matches the XML.
      • equals

        public boolean equals(java.lang.Object aObject)
        Returns true if the specified object is equivalent to this object.
        equals in class java.lang.Object
        aObject - the specified object.
        true if the specified object is equivalent to this object.
      • hashCode

        public int hashCode()
        Returns a hash code for this object. Equal objects must return the same hash code.
        hashCode in class java.lang.Object
        the hash code.