org.opensolaris.opengrok.search
Class Hit

java.lang.Object
  extended by org.opensolaris.opengrok.search.Hit
All Implemented Interfaces:
java.lang.Comparable<Hit>

public class Hit
extends java.lang.Object
implements java.lang.Comparable<Hit>

The hit class represents a single search hit


Constructor Summary
Hit()
          Creates a new instance of Hit
Hit(java.lang.String filename, java.lang.String line, java.lang.String lineno, boolean binary, boolean alt)
          Creates a new instance of Hit
 
Method Summary
 int compareTo(Hit o)
          Compare this object to another hit (in order to implement the comparable interface)
 boolean equals(java.lang.Object o)
          Check if two objects are equal.
 boolean getAlt()
          Should this be alternate file?
 java.lang.String getDirectory()
          Getter for property directory
 java.lang.String getFilename()
          Getter for property filename.
 java.lang.String getLine()
          Getter for property line.
 java.lang.String getLineno()
          Getter for property lineno.
 java.lang.String getPath()
          Getter for property path.
 java.lang.String getTag()
          Getter for property tag.
 int hashCode()
           
 boolean isBinary()
          Getter for property binary.
 void setBinary(boolean binary)
          Setter for property binary.
 void setFilename(java.lang.String filename)
          Setter for property filename.
 void setLine(java.lang.String line)
          Setter for property line.
 void setLineno(java.lang.String lineno)
          Setter for property lineno.
 void setTag(java.lang.String tag)
          Setter for property tag.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hit

public Hit()
Creates a new instance of Hit


Hit

public Hit(java.lang.String filename,
           java.lang.String line,
           java.lang.String lineno,
           boolean binary,
           boolean alt)
Creates a new instance of Hit

Parameters:
filename - The name of the file this hit represents
line - The line containing the match
lineno - The line number in the file the match was found
binary - If this is a binary file or not
alt - Is this the "alternate" file
Method Detail

getFilename

public java.lang.String getFilename()
Getter for property filename.

Returns:
Value of property filename.

getPath

public java.lang.String getPath()
Getter for property path.

Returns:
Value of property path.

getDirectory

public java.lang.String getDirectory()
Getter for property directory

Returns:
Value of property directory

setFilename

public void setFilename(java.lang.String filename)
Setter for property filename.

Parameters:
filename - New value of property filename.

getLine

public java.lang.String getLine()
Getter for property line.

Returns:
Value of property line.

setLine

public void setLine(java.lang.String line)
Setter for property line.

Parameters:
line - New value of property line.

getLineno

public java.lang.String getLineno()
Getter for property lineno.

Returns:
Value of property lineno.

setLineno

public void setLineno(java.lang.String lineno)
Setter for property lineno.

Parameters:
lineno - New value of property lineno.

compareTo

public int compareTo(Hit o)
              throws java.lang.ClassCastException
Compare this object to another hit (in order to implement the comparable interface)

Specified by:
compareTo in interface java.lang.Comparable<Hit>
Parameters:
o - The object to compare this object with
Returns:
the result of a toString().compareTo() of the filename
Throws:
java.lang.ClassCastException

isBinary

public boolean isBinary()
Getter for property binary.

Returns:
Value of property binary.

setBinary

public void setBinary(boolean binary)
Setter for property binary.

Parameters:
binary - New value of property binary.

getTag

public java.lang.String getTag()
Getter for property tag.

Returns:
Value of property tag.

setTag

public void setTag(java.lang.String tag)
Setter for property tag.

Parameters:
tag - New value of property tag.

getAlt

public boolean getAlt()
Should this be alternate file?

Returns:
true if this is the "alternate" file

equals

public boolean equals(java.lang.Object o)
Check if two objects are equal. Only consider the filename field to match the return value of the compareTo(Hit) method.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare with
Returns:
true if the filenames are equal

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object