Class Condition

    • Constructor Detail

      • Condition

        public Condition()
      • Condition

        public Condition​(java.lang.String label)
      • Condition

        public Condition​(java.lang.String label,
                         java.lang.String context)
    • Method Detail

      • setContextName

        public void setContextName​(java.lang.String contextName)
        Sets the name whatever is matched by this condition can be refered as, or null to make it unreferable
      • getContextName

        public java.lang.String getContextName()
        Returns the name whatever is matched by this condition can be refered as, or null if it is unreferable
      • isReferable

        protected boolean isReferable()
        Returns whether this is referable, returns context!=null by default
      • getLabel

        public java.lang.String getLabel()
        Sets the label of this. Set to null to use the default
      • setLabel

        public void setLabel​(java.lang.String label)
        Returns the label of this, or null if none (the default)
      • getNameSpace

        public java.lang.String getNameSpace()
        Returns the name of the namespace of this, or null if default (query)
      • setNameSpace

        public void setNameSpace​(java.lang.String nameSpace)
        Sets the name of the namespace of this
      • getParent

        public CompositeCondition getParent()
        Returns the condition this is nested within, or null if it is not nested
      • setAnchor

        public void setAnchor​(Condition.Anchor anchor)
        Sets a positional constraint on this condition
      • getAnchor

        public Condition.Anchor getAnchor()
        Returns the positional constraint on this anchor. This is never null
      • matches

        public final boolean matches​(RuleEvaluation e)

        Returns whether this condition matches the given evaluation at the current location of the evaluation. Calls the doesMatch method of each condition subtype.

      • matchesStartAnchor

        protected boolean matchesStartAnchor​(RuleEvaluation e)
        Check start anchor. Trace level 4 if no match
      • matchesEndAnchor

        protected boolean matchesEndAnchor​(RuleEvaluation e)
        Check start anchor. Trace level 4 if no match
      • traceResult

        protected void traceResult​(boolean matches,
                                   RuleEvaluation e)
      • getMatchInfoString

        protected java.lang.String getMatchInfoString​(RuleEvaluation e)
      • preMatchHook

        protected void preMatchHook​(RuleEvaluation e)
        Called when match is called, before anything else. Always call super.preMatchHook when overriding.
      • postMatchHook

        protected void postMatchHook​(RuleEvaluation e)
        Called just before match returns, on any return condition including exceptions. Always call super.postMatchHook when overriding
      • getMatchInfo

        protected java.lang.String getMatchInfo​(RuleEvaluation e)
        Override this to return a string describing what this condition has matched in this evaluation. Will only be called when this condition is actually matched in this condition
        info about what is matched, or null if there is no info to return (default)
      • doesMatch

        protected abstract boolean doesMatch​(RuleEvaluation e)
        Returns whether this condition matches the given evaluation at the current location of the evaluation. If there is a match, the evaluation must be advanced to the location beyond the matching item(s) before this method returns.
      • hasOpenChoicepoint

        protected boolean hasOpenChoicepoint​(RuleEvaluation e)
        Returns whether there is an open choice in this or any of its subconditions. Returns false by default, must be overriden by conditions which may generate choices open accross multiple calls to matches, or contain such conditions.
      • makeReferences

        public void makeReferences​(RuleBase rules)
        Override if references needs to be set in this condition of its children
      • getLabelString

        protected java.lang.String getLabelString()
      • labelMatches

        protected boolean labelMatches​(RuleEvaluation e)
        Whether the label matches the current item, true if there is no current item
      • toInnerString

        protected abstract java.lang.String toInnerString()
        All instances of this produces a parseable string output
      • isDefaultContextName

        protected boolean isDefaultContextName()
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object