gov.sandia.cognition.text
Class AbstractOccurrenceInText<DataType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.text.AbstractOccurrenceInText<DataType>
Type Parameters:
DataType - The type of data that occurred in the text.
All Implemented Interfaces:
OccurrenceInText<DataType>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
DefaultTermOccurrence, DefaultToken

public abstract class AbstractOccurrenceInText<DataType>
extends AbstractCloneableSerializable
implements OccurrenceInText<DataType>

An abstract implementation of the OccurrenceInText interface. It holds the start and length.

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

Field Summary
static int DEFAULT_LENGTH
          The default length is 0.
static int DEFAULT_START
          The default start is 0.
protected  int length
          The length of the occurrence.
protected  int start
          The starting point of the occurrence.
 
Constructor Summary
AbstractOccurrenceInText()
          Creates a new AbstractOccurrenceInText.
AbstractOccurrenceInText(int start, int length)
          Creates a new AbstractOccurrenceInText.
 
Method Summary
 int getLength()
          Gets the length of text where the occurrence appears.
 int getStart()
          Gets the starting index of the occurrence in the text.
 void setLength(int length)
          Sets the length of the occurrence.
 void setStart(int start)
          Sets the starting point of the occurrence.
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.text.OccurrenceInText
getData
 

Field Detail

DEFAULT_START

public static final int DEFAULT_START
The default start is 0.

See Also:
Constant Field Values

DEFAULT_LENGTH

public static final int DEFAULT_LENGTH
The default length is 0.

See Also:
Constant Field Values

start

protected int start
The starting point of the occurrence.


length

protected int length
The length of the occurrence.

Constructor Detail

AbstractOccurrenceInText

public AbstractOccurrenceInText()
Creates a new AbstractOccurrenceInText.


AbstractOccurrenceInText

public AbstractOccurrenceInText(int start,
                                int length)
Creates a new AbstractOccurrenceInText.

Parameters:
start - The starting point of the occurrence.
length - The length of the occurrence.
Method Detail

getStart

public int getStart()
Description copied from interface: OccurrenceInText
Gets the starting index of the occurrence in the text.

Specified by:
getStart in interface OccurrenceInText<DataType>
Returns:
The starting index of the occurrence in the text.

setStart

public void setStart(int start)
Sets the starting point of the occurrence. Must be non-negative.

Parameters:
start - The starting point of the occurrence.

getLength

public int getLength()
Description copied from interface: OccurrenceInText
Gets the length of text where the occurrence appears.

Specified by:
getLength in interface OccurrenceInText<DataType>
Returns:
The length of text where the occurrence appears.

setLength

public void setLength(int length)
Sets the length of the occurrence. Must be non-negative.

Parameters:
length - The length of the occurrence.