Class DocumentSelector


  • public class DocumentSelector
    extends java.lang.Object

    A document selector is a filter which accepts or rejects documents based on their type and content. A document selector has a textual representation which is called the Document Selection Language

    Document selectors are multithread safe.

    Author:
    bratseth
    • Constructor Summary

      Constructors 
      Constructor Description
      DocumentSelector​(java.lang.String selector)
      Creates a document selector from a Document Selection Language string
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Result accepts​(DocumentOperation op)
      Returns true if the document referenced by this document operation is accepted by this selector
      Result accepts​(Context context)
      Returns true if the document referenced by this context is accepted by this selector
      ResultList getMatchingResultList​(DocumentOperation op)
      Returns the list of different variables resulting in a true state for this expression
      java.lang.String toString()
      Returns this selector as a Document Selection Language string
      void visit​(Visitor visitor)
      Visits the expression tree
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DocumentSelector

        public DocumentSelector​(java.lang.String selector)
                         throws ParseException
        Creates a document selector from a Document Selection Language string
        Parameters:
        selector - the string to parse as a selector
        Throws:
        ParseException - Thrown if the string could not be parsed
    • Method Detail

      • accepts

        public Result accepts​(DocumentOperation op)
        Returns true if the document referenced by this document operation is accepted by this selector
        Parameters:
        op - a document operation
        Returns:
        true if the document is accepted
        Throws:
        java.lang.RuntimeException - if the evaluation enters an illegal state
      • accepts

        public Result accepts​(Context context)
        Returns true if the document referenced by this context is accepted by this selector
        Parameters:
        context - the context to match in
        Returns:
        true if the document is accepted
        Throws:
        java.lang.RuntimeException - if the evaluation enters an illegal state
      • getMatchingResultList

        public ResultList getMatchingResultList​(DocumentOperation op)
        Returns the list of different variables resulting in a true state for this expression
        Parameters:
        op - the document to evaluate
        Returns:
        true if the document is accepted
        Throws:
        java.lang.RuntimeException - if the evaluation enters an illegal state
      • toString

        public java.lang.String toString()
        Returns this selector as a Document Selection Language string
        Overrides:
        toString in class java.lang.Object
      • visit

        public void visit​(Visitor visitor)
        Visits the expression tree