Class NearItem

All Implemented Interfaces:
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 Details

    • distance

      protected int distance
    • defaultDistance

      public static final int defaultDistance
      The default distance used if none is specified: 2
      See Also:
  • Constructor Details

    • 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 Details

    • 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 String getName()
      Description copied from class: Item
      Returns the name of this item
      Specified by:
      getName in class Item
    • encodeThis

      protected void encodeThis(ByteBuffer buffer)
      Description copied from class: CompositeItem
      Encodes just this item, not its regular subitems, to the given buffer.
      Overrides:
      encodeThis in class CompositeItem
    • disclose

      public void disclose(Discloser discloser)
      Overrides:
      disclose in class CompositeItem
    • appendHeadingString

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

      public boolean equals(Object object)
      Description copied from class: CompositeItem
      Returns whether this item is of the same class and contains the same state as the given item.
      Overrides:
      equals in class CompositeItem
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CompositeItem