Class PhraseNot

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public final class PhraseNot
    extends Phrase
    Phrase operator that matches an include phrase as long as it does not contain an exlude phrase.
    See Also:
    Serialized Form
    • Constructor Detail

      • PhraseNot

        public PhraseNot()
        Constructor.
      • PhraseNot

        public PhraseNot​(Phrase includePhrase,
                         Phrase excludePhrase)
        Constructor.
    • Method Detail

      • getStartOffset

        public int getStartOffset()
        Get the start offset (0 indexed, inclusive) for this term in the original query string.

        This value is set during parsing and indicates the start offset into the original query string that this term represents. In general, offsets should not be set/modified by query transformers and it is recommended that start and end offsets are set to zero when cloning.

        NOTE: if Phrase.getStartOffset() == Phrase.getEndOffset(), this indicates that the term did not come from a parsed query string.

        Specified by:
        getStartOffset in class Phrase
      • getEndOffset

        public int getEndOffset()
        Get the end offset (0 indexed, exclusive) for this term in the original query string.

        This value is set during parsing and indicates the end offset of the original query string that this term represents. In general, offsets should not be set/modified by query transformers and it is recommended that start and end offsets are set to zero when cloning.

        NOTE: if Phrase.getStartOffset() == Phrase.getEndOffset(), this indicates that the term did not come from a parsed query string.

        Specified by:
        getEndOffset in class Phrase
      • getIncludePhrase

        public Phrase getIncludePhrase()
      • setIncludePhrase

        public void setIncludePhrase​(Phrase value)
      • getExcludePhrase

        public Phrase getExcludePhrase()
      • setExcludePhrase

        public void setExcludePhrase​(Phrase value)
      • rewrite

        public Phrase rewrite​(PhraseHandler handler)
        Recursively rewrite this phrase using handler.

        NOTE: If a phrase has any children, the phrase itself will be passed to handler first, prior to its children. If handler returns a new phrase, its children will not be traversed automatically.

        Overrides:
        rewrite in class Phrase
      • rewriteChildren

        public Phrase rewriteChildren​(PhraseHandler handler)
        Rewrite any children of this phrase using handler.

        Returns the modified phrase, which may be null if all children were removed by handler.

        This method may have no effect if this Phrase represents a leaf in the tree.

        NOTE: child phrases are not recursively traversed.

        Specified by:
        rewriteChildren in class Phrase
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Phrase
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class Phrase
      • toString

        public void toString​(java.lang.StringBuilder buffer,
                             boolean compact)
        Appends the string representation of this query to buffer.
        Specified by:
        toString in class Phrase