edu.mit.jwi.item
Class IndexWordID

java.lang.Object
  extended by edu.mit.jwi.item.IndexWordID
All Implemented Interfaces:
IHasPOS, IIndexWordID, IItemID<IIndexWord>, java.io.Serializable

public class IndexWordID
extends java.lang.Object
implements IIndexWordID

Default implementation of IIndexWordID.

Since:
JWI 1.0
Version:
2.4.0
Author:
Mark A. Finlayson
See Also:
Serialized Form

Field Summary
protected static java.util.regex.Pattern whitespace
          Whitespace pattern for use in replacing whitespace with underscores
 
Constructor Summary
IndexWordID(java.lang.String lemma, POS pos)
          Constructs an index word id object with the specified lemma and part of speech.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getLemma()
          Returns the lemma (root form) of the index word that this ID indicates.
 POS getPOS()
          Returns the associated part of speech for this object.
 int hashCode()
           
static IndexWordID parseIndexWordID(java.lang.String value)
          Convenience method for transforming the result of the toString() method into an IndexWordID
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

whitespace

protected static final java.util.regex.Pattern whitespace
Whitespace pattern for use in replacing whitespace with underscores

Since:
JWI 2.1.2
Constructor Detail

IndexWordID

public IndexWordID(java.lang.String lemma,
                   POS pos)
Constructs an index word id object with the specified lemma and part of speech. Since all index entries are in lower case, with whitespace converted to underscores, this constructor applies this conversion.

Parameters:
lemma - the lemma for the id
pos - the part of speech for the id
Throws:
java.lang.NullPointerException - if either argument is null
java.lang.IllegalArgumentException - if the lemma is empty or all whitespace
Since:
JWI 1.0
Method Detail

getLemma

public java.lang.String getLemma()
Description copied from interface: IIndexWordID
Returns the lemma (root form) of the index word that this ID indicates. The lemma will never be null, empty, or all whitespace.

Specified by:
getLemma in interface IIndexWordID
Returns:
the lemma of the index word

getPOS

public POS getPOS()
Description copied from interface: IHasPOS
Returns the associated part of speech for this object. If this object is not associated with any particular part of speech, this method may return null.

Specified by:
getPOS in interface IHasPOS
Returns:
The associated part of speech, or null if none.

hashCode

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

equals

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

toString

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

parseIndexWordID

public static IndexWordID parseIndexWordID(java.lang.String value)
Convenience method for transforming the result of the toString() method into an IndexWordID

Parameters:
value - the string to be parsed
Returns:
the index word id
Throws:
java.lang.NullPointerException - if the specified string is null
java.lang.IllegalArgumentException - if the specified string does not conform to an index word id string
Since:
JWI 1.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.