edu.columbia.cs.ref.model.entity
Class Entity

java.lang.Object
  extended by edu.columbia.cs.ref.model.entity.Entity
All Implemented Interfaces:
Matchable, java.io.Serializable, java.lang.Comparable<Entity>

public class Entity
extends java.lang.Object
implements java.lang.Comparable<Entity>, java.io.Serializable, Matchable

The Class Entity represents entities that are present in a text.

An entity is composed by five basic attributes:

1) An unique identifier

2) The entity type of the entity

3) The starting index of the entity in the document

4) The length of the entity

5) The document where the entity is contained

Since:
2011-09-27
Version:
0.1
Author:
Pablo Barrio, Goncalo Simoes
See Also:
Serialized Form

Field Summary
static Entity NULL_ENTITY
          The Constant NULL_ENTITY.
 
Constructor Summary
Entity(java.lang.String id, java.lang.String entityType, int offset, int length, java.lang.String value, Document doc)
          Instantiates a new Entity.
 
Method Summary
 int compareTo(Entity o)
           
 boolean equals(java.lang.Object o)
           
 Document getDocument()
          Gets the document where the entity belongs.
 java.lang.String getEntityType()
          Gets the entity type.
 java.lang.String getId()
          Gets the id of the entity.
 int getLength()
          Gets the length of the entity.
 int getOffset()
          Gets the starting index of the entity in the text.
 java.lang.String getValue()
          Gets the value of the entity.
 int hashCode()
           
 void setDocument(Document document)
          Sets the document where the entity belongs.
 void setEntityType(java.lang.String entityType)
          Sets the entity type.
 void setId(java.lang.String id)
          Sets the id of the entity.
 void setLength(int length)
          Sets the length of the entity.
 void setOffset(int offset)
          Sets the starting index of the entity in the text
 void setValue(java.lang.String value)
          Sets the value of the entity.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_ENTITY

public static final Entity NULL_ENTITY
The Constant NULL_ENTITY.

Constructor Detail

Entity

public Entity(java.lang.String id,
              java.lang.String entityType,
              int offset,
              int length,
              java.lang.String value,
              Document doc)
Instantiates a new Entity.

Parameters:
id - the id of the entity
entityType - the entity type
offset - the starting index of the entity in the document
length - the length of the entity
value - the value of the entity
doc - the document where the entity belongs
Method Detail

getId

public java.lang.String getId()
Gets the id of the entity.

Returns:
the id of the entity

setId

public void setId(java.lang.String id)
Sets the id of the entity.

Parameters:
id - the new id of the entity

getEntityType

public java.lang.String getEntityType()
Gets the entity type.

Returns:
the entity type

setEntityType

public void setEntityType(java.lang.String entityType)
Sets the entity type.

Parameters:
entityType - the new entity type

getOffset

public int getOffset()
Gets the starting index of the entity in the text.

Returns:
the starting index of the entity in the text

setOffset

public void setOffset(int offset)
Sets the starting index of the entity in the text

Parameters:
offset - starting index of the entity in the text

getLength

public int getLength()
Gets the length of the entity.

Returns:
the length of the entity

setLength

public void setLength(int length)
Sets the length of the entity.

Parameters:
length - length of the entity

getValue

public java.lang.String getValue()
Gets the value of the entity.

Returns:
the value of the entity

setValue

public void setValue(java.lang.String value)
Sets the value of the entity.

Parameters:
value - the new value of the entity

getDocument

public Document getDocument()
Gets the document where the entity belongs.

Returns:
the document where the entity belongs

setDocument

public void setDocument(Document document)
Sets the document where the entity belongs.

Parameters:
document - the new document where the entity belongs

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(Entity o)
Specified by:
compareTo in interface java.lang.Comparable<Entity>

hashCode

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

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object