edu.mit.jwi.item
Class SynsetID

java.lang.Object
  extended by edu.mit.jwi.item.SynsetID
All Implemented Interfaces:
IHasPOS, IItemID<ISynset>, ISynsetID, java.io.Serializable

public class SynsetID
extends java.lang.Object
implements ISynsetID

Default implementation of the ISynsetID interface

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

Field Summary
static java.lang.String synsetIDPrefix
          String prefix for the toString() method.
 
Constructor Summary
SynsetID(int offset, POS pos)
          Constructs a new synset id with the specified offset and part of speech.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getOffset()
          Returns the offset for the specified synset.
 POS getPOS()
          Returns the associated part of speech for this object.
 int hashCode()
           
static SynsetID parseSynsetID(java.lang.String value)
          Convenience method for transforming the result of the toString() method back into an ISynsetID.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

synsetIDPrefix

public static final java.lang.String synsetIDPrefix
String prefix for the toString() method.

Since:
JWI 2.0.0
See Also:
Constant Field Values
Constructor Detail

SynsetID

public SynsetID(int offset,
                POS pos)
Constructs a new synset id with the specified offset and part of speech.

Parameters:
offset - the offset
pos - the part of speech; may not be null
Throws:
java.lang.NullPointerException - if the specified part of speech is null
java.lang.IllegalArgumentException - if the specified offset is not a legal offset
Since:
JWI 1.0
Method Detail

getOffset

public int getOffset()
Description copied from interface: ISynsetID
Returns the offset for the specified synset.

Specified by:
getOffset in interface ISynsetID
Returns:
the byte offset for the specified synset

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

parseSynsetID

public static SynsetID parseSynsetID(java.lang.String value)
Convenience method for transforming the result of the toString() method back into an ISynsetID. Synset IDs are always 14 characters long and have the following format: SID-########-C, where ######## is the zero-filled eight decimal digit offset of the synset, and C is the upper-case character code indicating the part of speech.

Parameters:
value - the string representation of the id; may include leading or trailing whitespace
Returns:
a synset id object corresponding to the specified string representation
Throws:
java.lang.NullPointerException - if the specified string is null
java.lang.IllegalArgumentException - if the specified string is not a properly formatted synset id
Since:
JWI 1.0


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