edu.mit.jmwe.data
Class AbstractMWEDesc.AbstractPart

java.lang.Object
  extended by edu.mit.jmwe.data.AbstractMWEDesc.AbstractPart
All Implemented Interfaces:
IHasForm, IMWEDesc.IPart, Comparable<IMWEDesc.IPart>
Direct Known Subclasses:
InfMWEDesc.InfPart, RootMWEDesc.Part
Enclosing class:
AbstractMWEDesc<P extends IMWEDesc.IPart>

protected abstract class AbstractMWEDesc.AbstractPart
extends Object
implements IMWEDesc.IPart

Default implementation of the IPart interface.

Since:
jMWE 1.0.0
Version:
$Id: AbstractMWEDesc.java 620 2011-05-08 21:13:58Z markaf $
Author:
M.A. Finlayson

Constructor Summary
AbstractMWEDesc.AbstractPart(String form, int index)
          Constructs a new part.
 
Method Summary
 int compareTo(IMWEDesc.IPart o)
           
 boolean equals(Object obj)
           
 String getForm()
          Returns the object's surface form text, exactly as it appears in its original context, with capitalization intact.
 int getIndex()
          Returns the index of this part in the multi-word expression, always zero or greater.
 IMWEDesc getParent()
          Returns the MWE description of which this part is a part.
 int hashCode()
           
 boolean isStopWord()
          Returns true if the part is a stop word, that is, a word that is not usually useful for searching.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMWEDesc.AbstractPart

public AbstractMWEDesc.AbstractPart(String form,
                                    int index)
Constructs a new part.

Parameters:
form - the surface text of the part in the multi-word expression, in its original form. It's trimmed form not be null or contain whitespace.
index - the index of the part in the multi-word expression. May not be less than 0.
Throws:
NullPointerException - if the parent or text is null.
IllegalArgumentException - if the trimmed text is empty or contains whitespace, or if the index is less than 0.
Since:
jMWE 1.0.0
Method Detail

getParent

public IMWEDesc getParent()
Description copied from interface: IMWEDesc.IPart
Returns the MWE description of which this part is a part. Will never return null.

Specified by:
getParent in interface IMWEDesc.IPart
Returns:
the MWE description that contains this part.

getForm

public String getForm()
Description copied from interface: IHasForm
Returns the object's surface form text, exactly as it appears in its original context, with capitalization intact. May be a single word or punctuation. The surface form may not contain whitespace or underscores. This method will never return null.

Specified by:
getForm in interface IHasForm
Returns:
the original text, never null.

getIndex

public int getIndex()
Description copied from interface: IMWEDesc.IPart
Returns the index of this part in the multi-word expression, always zero or greater.

Specified by:
getIndex in interface IMWEDesc.IPart
Returns:
the non-negative index of this part in the multi-word expression.

isStopWord

public boolean isStopWord()
Description copied from interface: IMWEDesc.IPart
Returns true if the part is a stop word, that is, a word that is not usually useful for searching.

Specified by:
isStopWord in interface IMWEDesc.IPart
Returns:
true if the part is a stop word; false otherwise.

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(IMWEDesc.IPart o)
Specified by:
compareTo in interface Comparable<IMWEDesc.IPart>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.