Class DocumentSelector


  • public class DocumentSelector
    extends 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 Detail

      • DocumentSelector

        public DocumentSelector​(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:
        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:
        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:
        RuntimeException - if the evaluation enters an illegal state
      • toString

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

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