Class Match

java.lang.Object
org.eclipse.search.ui.text.Match

public class Match extends Object
A textual match in a given object. This class may be instantiated and also subclassed (to add additional match state like accuracy, etc). The element a match is reported against is assumed to contain the match, and the UI will group matches against the same element together. A match has an offset and a length which may be specified in characters or in lines.
Since:
3.0
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A constant expressing that offset and length of this match are specified in characters
    static final int
    A constant expressing that offset and length of this match are specified in lines
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Match(Object element, int offset, int length)
    Constructs a new Match object.
    Match(Object element, int unit, int offset, int length)
    Constructs a new Match object.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    int
    Returns whether match length and offset are expressed in lines or characters.
    Returns the element that contains this match.
    int
    Returns the length of this match.
    int
    Returns the offset of this match.
    boolean
    Returns whether this match is filtered or not.
    void
    setFiltered(boolean value)
    Marks this match as filtered or not.
    void
    setLength(int length)
    Sets the length.
    void
    setOffset(int offset)
    Sets the offset of this match.
    for debug only

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details Link icon

    • UNIT_LINE Link icon

      public static final int UNIT_LINE
      A constant expressing that offset and length of this match are specified in lines
      See Also:
    • UNIT_CHARACTER Link icon

      public static final int UNIT_CHARACTER
      A constant expressing that offset and length of this match are specified in characters
      See Also:
  • Constructor Details Link icon

    • Match Link icon

      public Match(Object element, int unit, int offset, int length)
      Constructs a new Match object.
      Parameters:
      element - the element that contains the match
      unit - the unit offset and length are based on
      offset - the offset the match starts at
      length - the length of the match
    • Match Link icon

      public Match(Object element, int offset, int length)
      Constructs a new Match object. The offset and length will be based on characters.
      Parameters:
      element - the element that contains the match
      offset - the offset the match starts at
      length - the length of the match
  • Method Details Link icon

    • getOffset Link icon

      public int getOffset()
      Returns the offset of this match.
      Returns:
      the offset
    • setOffset Link icon

      public void setOffset(int offset)
      Sets the offset of this match.
      Parameters:
      offset - the offset to set
    • getLength Link icon

      public int getLength()
      Returns the length of this match.
      Returns:
      the length
    • setLength Link icon

      public void setLength(int length)
      Sets the length.
      Parameters:
      length - the length to set
    • getElement Link icon

      public Object getElement()
      Returns the element that contains this match. The element is used to group the match.
      Returns:
      the element that contains this match
    • getBaseUnit Link icon

      public int getBaseUnit()
      Returns whether match length and offset are expressed in lines or characters.
      Returns:
      either UNIT_LINE or UNIT_CHARACTER;
    • setFiltered Link icon

      public void setFiltered(boolean value)
      Marks this match as filtered or not.
      Parameters:
      value - true if the match is filtered; otherwise false
      Since:
      3.1
    • isFiltered Link icon

      public boolean isFiltered()
      Returns whether this match is filtered or not.
      Returns:
      true if the match is filtered; otherwise false
      Since:
      3.1
    • toString Link icon

      public String toString()
      for debug only
      Overrides:
      toString in class Object