gov.sandia.cognition.text.term
Class DefaultTermOccurrence

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.text.AbstractOccurrenceInText<Term>
          extended by gov.sandia.cognition.text.term.DefaultTermOccurrence
All Implemented Interfaces:
OccurrenceInText<Term>, Termable, TermOccurrence, CloneableSerializable, Serializable, Cloneable

public class DefaultTermOccurrence
extends AbstractOccurrenceInText<Term>
implements TermOccurrence

A default implementation of the TermOccurrence interface. It just holds the term plus where it occurred.

Since:
3.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
protected  Term term
          The term that occurred.
 
Fields inherited from class gov.sandia.cognition.text.AbstractOccurrenceInText
DEFAULT_LENGTH, DEFAULT_START, length, start
 
Constructor Summary
DefaultTermOccurrence()
          Creates a new DefaultTermOccurrence with default values.
DefaultTermOccurrence(Term term, int start, int length)
          Creates a new DefaultTermOccurrence.
 
Method Summary
 Term asTerm()
          Get the term for the object.
 boolean equals(DefaultTermOccurrence other)
          Determines if this DefaultTermOccurrence equals a given DefaultTermOccurrence.
 boolean equals(Object other)
           
 Term getData()
          Gets the data that occurred in the text.
 Term getTerm()
          Gets the term that occurred in the text.
 int hashCode()
           
 void setTerm(Term term)
          Sets the term that occurred.
 
Methods inherited from class gov.sandia.cognition.text.AbstractOccurrenceInText
getLength, getStart, setLength, setStart
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.text.OccurrenceInText
getLength, getStart
 

Field Detail

term

protected Term term
The term that occurred.

Constructor Detail

DefaultTermOccurrence

public DefaultTermOccurrence()
Creates a new DefaultTermOccurrence with default values.


DefaultTermOccurrence

public DefaultTermOccurrence(Term term,
                             int start,
                             int length)
Creates a new DefaultTermOccurrence.

Parameters:
term - The term that occurred.
start - The starting point of the occurrence in the source text.
length - The length of the occurrence in the source text.
Method Detail

asTerm

public Term asTerm()
Description copied from interface: Termable
Get the term for the object. This can be either a representation of the object as a term or a term that is part of the object.

Specified by:
asTerm in interface Termable
Returns:
The term representation of the object.

getData

public Term getData()
Description copied from interface: OccurrenceInText
Gets the data that occurred in the text.

Specified by:
getData in interface OccurrenceInText<Term>
Returns:
The data that occurred.

getTerm

public Term getTerm()
Description copied from interface: TermOccurrence
Gets the term that occurred in the text.

Specified by:
getTerm in interface TermOccurrence
Returns:
The term that occurred in the text.

setTerm

public void setTerm(Term term)
Sets the term that occurred.

Parameters:
term - The term that occurred.

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(DefaultTermOccurrence other)
Determines if this DefaultTermOccurrence equals a given DefaultTermOccurrence.

Parameters:
other - The other object.
Returns:
True if the two objects are equal; otherwise, false.