Class NearItem

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    ONearItem

    public class NearItem
    extends CompositeItem
    A set of terms which must be near each other to match.
    Author:
    bratseth, havardpe
    • Field Detail

      • distance

        protected int distance
      • defaultDistance

        public static final int defaultDistance
        The default distance used if none is specified: 2
        See Also:
        Constant Field Values
    • Constructor Detail

      • NearItem

        public NearItem()
        Creates a NEAR item with distance 2
      • NearItem

        public NearItem​(int distance)
        Creates a near item with a limit to the distance between the words.
        Parameters:
        distance - the maximum position difference between the words which should be counted as a match
    • Method Detail

      • setDistance

        public void setDistance​(int distance)
      • getDistance

        public int getDistance()
      • getItemType

        public Item.ItemType getItemType()
        Description copied from class: Item
        Return the enumerated type of this item.
        Specified by:
        getItemType in class Item
      • getName

        public java.lang.String getName()
        Description copied from class: Item
        Returns the name of this item
        Specified by:
        getName in class Item
      • encodeThis

        protected void encodeThis​(java.nio.ByteBuffer buffer)
        Description copied from class: CompositeItem
        Encodes just this item, not it's usual subitems, to the given buffer.
        Overrides:
        encodeThis in class CompositeItem
      • appendHeadingString

        protected void appendHeadingString​(java.lang.StringBuilder buffer)
        Appends the heading of this string - [getName()]([limit])
        Overrides:
        appendHeadingString in class Item
      • equals

        public boolean equals​(java.lang.Object object)
        Returns whether this item is of the same class and contains the same state as the given item
        Overrides:
        equals in class CompositeItem