edu.mit.jwi.item
Class LexFile

java.lang.Object
  extended by edu.mit.jwi.item.LexFile
All Implemented Interfaces:
IHasPOS, ILexFile, java.io.Serializable
Direct Known Subclasses:
UnknownLexFile

public class LexFile
extends java.lang.Object
implements ILexFile

Concrete implementation of the ILexFile interface. This class includes, as public fields, all lexical files defined in the standard WordNet distribution.

This class in not implemented as an Enum so that clients may instantiate their own lexical file objects using this implementation.

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

Field Summary
static LexFile ADJ_ALL
           
static LexFile ADJ_PERT
           
static LexFile ADJ_PPL
           
static LexFile ADV_ALL
           
static LexFile NOUN_ACT
           
static LexFile NOUN_ANIMAL
           
static LexFile NOUN_ARTIFACT
           
static LexFile NOUN_ATTRIBUTE
           
static LexFile NOUN_BODY
           
static LexFile NOUN_COGNITION
           
static LexFile NOUN_COMMUNICATION
           
static LexFile NOUN_EVENT
           
static LexFile NOUN_FEELING
           
static LexFile NOUN_FOOD
           
static LexFile NOUN_GROUP
           
static LexFile NOUN_LOCATION
           
static LexFile NOUN_MOTIVE
           
static LexFile NOUN_OBJECT
           
static LexFile NOUN_PERSON
           
static LexFile NOUN_PHENOMENON
           
static LexFile NOUN_PLANT
           
static LexFile NOUN_POSSESSION
           
static LexFile NOUN_PROCESS
           
static LexFile NOUN_QUANTITY
           
static LexFile NOUN_RELATION
           
static LexFile NOUN_SHAPE
           
static LexFile NOUN_STATE
           
static LexFile NOUN_SUBSTANCE
           
static LexFile NOUN_TIME
           
static LexFile NOUN_TOPS
           
static LexFile VERB_BODY
           
static LexFile VERB_CHANGE
           
static LexFile VERB_COGNITION
           
static LexFile VERB_COMMUNICATION
           
static LexFile VERB_COMPETITION
           
static LexFile VERB_CONSUMPTION
           
static LexFile VERB_CONTACT
           
static LexFile VERB_CREATION
           
static LexFile VERB_EMOTION
           
static LexFile VERB_MOTION
           
static LexFile VERB_PERCEPTION
           
static LexFile VERB_POSESSION
           
static LexFile VERB_SOCIAL
           
static LexFile VERB_STATIVE
           
static LexFile VERB_WEATHER
           
 
Constructor Summary
LexFile(int num, java.lang.String name, java.lang.String desc, POS pos)
          Constructs a new lexical file description object.
 
Method Summary
static void checkLexicalFileNumber(int num)
          Throws an exception if the specified lexical file number is not a valid lexical file number
protected static java.lang.String checkString(java.lang.String str)
          Throws an exception if the specified string is null, empty, or all whitespace.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDescription()
          Returns a description of the lexicographer file contents.
static LexFile getLexicalFile(int num)
          A convenience method that allows retrieval of one of the built-in lexical file descriptions given the number.
static java.lang.String getLexicalFileNumberString(int num)
          Returns a two-character string representation of a lexical file number, zero-filled if necessary.
 java.lang.String getName()
          Returns the name of the lexicographer file.
 int getNumber()
          Returns the number of the lexicographer file.
 POS getPOS()
          Returns the associated part of speech for this object.
 int hashCode()
           
static boolean isIllegalLexicalFileNumber(int num)
          Returns true if the number represents a valid lexical file number, namely, a number in in the closed range [0, 99]; returns false otherwise.
protected  java.lang.Object readResolve()
          This utility method implements the appropriate deserialization for this object.
 java.lang.String toString()
           
static java.util.Collection<LexFile> values()
          Emulates the Enum#values() function.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ADJ_ALL

public static final LexFile ADJ_ALL

ADJ_PERT

public static final LexFile ADJ_PERT

ADV_ALL

public static final LexFile ADV_ALL

NOUN_TOPS

public static final LexFile NOUN_TOPS

NOUN_ACT

public static final LexFile NOUN_ACT

NOUN_ANIMAL

public static final LexFile NOUN_ANIMAL

NOUN_ARTIFACT

public static final LexFile NOUN_ARTIFACT

NOUN_ATTRIBUTE

public static final LexFile NOUN_ATTRIBUTE

NOUN_BODY

public static final LexFile NOUN_BODY

NOUN_COGNITION

public static final LexFile NOUN_COGNITION

NOUN_COMMUNICATION

public static final LexFile NOUN_COMMUNICATION

NOUN_EVENT

public static final LexFile NOUN_EVENT

NOUN_FEELING

public static final LexFile NOUN_FEELING

NOUN_FOOD

public static final LexFile NOUN_FOOD

NOUN_GROUP

public static final LexFile NOUN_GROUP

NOUN_LOCATION

public static final LexFile NOUN_LOCATION

NOUN_MOTIVE

public static final LexFile NOUN_MOTIVE

NOUN_OBJECT

public static final LexFile NOUN_OBJECT

NOUN_PERSON

public static final LexFile NOUN_PERSON

NOUN_PHENOMENON

public static final LexFile NOUN_PHENOMENON

NOUN_PLANT

public static final LexFile NOUN_PLANT

NOUN_POSSESSION

public static final LexFile NOUN_POSSESSION

NOUN_PROCESS

public static final LexFile NOUN_PROCESS

NOUN_QUANTITY

public static final LexFile NOUN_QUANTITY

NOUN_RELATION

public static final LexFile NOUN_RELATION

NOUN_SHAPE

public static final LexFile NOUN_SHAPE

NOUN_STATE

public static final LexFile NOUN_STATE

NOUN_SUBSTANCE

public static final LexFile NOUN_SUBSTANCE

NOUN_TIME

public static final LexFile NOUN_TIME

VERB_BODY

public static final LexFile VERB_BODY

VERB_CHANGE

public static final LexFile VERB_CHANGE

VERB_COGNITION

public static final LexFile VERB_COGNITION

VERB_COMMUNICATION

public static final LexFile VERB_COMMUNICATION

VERB_COMPETITION

public static final LexFile VERB_COMPETITION

VERB_CONSUMPTION

public static final LexFile VERB_CONSUMPTION

VERB_CONTACT

public static final LexFile VERB_CONTACT

VERB_CREATION

public static final LexFile VERB_CREATION

VERB_EMOTION

public static final LexFile VERB_EMOTION

VERB_MOTION

public static final LexFile VERB_MOTION

VERB_PERCEPTION

public static final LexFile VERB_PERCEPTION

VERB_POSESSION

public static final LexFile VERB_POSESSION

VERB_SOCIAL

public static final LexFile VERB_SOCIAL

VERB_STATIVE

public static final LexFile VERB_STATIVE

VERB_WEATHER

public static final LexFile VERB_WEATHER

ADJ_PPL

public static final LexFile ADJ_PPL
Constructor Detail

LexFile

public LexFile(int num,
               java.lang.String name,
               java.lang.String desc,
               POS pos)
Constructs a new lexical file description object.

Parameters:
num - the lexical file number, in the closed range [0,99]
name - the name of the lexical file, may not be null, empty, or all whitespace
desc - the description of the lexical file, may not be null, empty, or all whitespace
pos - the part of speech for the lexical file, may be null
Throws:
java.lang.NullPointerException - if either the name or description are null
java.lang.IllegalArgumentException - if either the name or description are empty or all whitespace
Since:
JWI 2.1.0
Method Detail

getNumber

public int getNumber()
Description copied from interface: ILexFile
Returns the number of the lexicographer file. This is used in sense keys and the data files. A lexical file number is always in the closed range [0, 99].

Specified by:
getNumber in interface ILexFile
Returns:
the lexicograph file number, between 0 and 99, inclusive.

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.

getName

public java.lang.String getName()
Description copied from interface: ILexFile
Returns the name of the lexicographer file. The string will not be null, empty, or all whitespace.

Specified by:
getName in interface ILexFile
Returns:
the lexicographer file name

getDescription

public java.lang.String getDescription()
Description copied from interface: ILexFile
Returns a description of the lexicographer file contents. The string will not be null, empty, or all whitespace.

Specified by:
getDescription in interface ILexFile
Returns:
a description of the lexicographer file contents

toString

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

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

readResolve

protected java.lang.Object readResolve()
This utility method implements the appropriate deserialization for this object.

Returns:
the appropriate deserialized object.
Since:
JWI 2.4.0

checkString

protected static java.lang.String checkString(java.lang.String str)
Throws an exception if the specified string is null, empty, or all whitespace. Returns a trimmed form of the string.

Parameters:
str - the string to be checked
Returns:
a trimmed form of the string
Throws:
java.lang.NullPointerException - if the specified string is null
java.lang.IllegalArgumentException - if the specified string is empty or all whitespace
Since:
JWI 2.2.0

checkLexicalFileNumber

public static void checkLexicalFileNumber(int num)
Throws an exception if the specified lexical file number is not a valid lexical file number

Parameters:
num - the number to be checked
Throws:
java.lang.IllegalArgumentException - if the specified lexical file number is not a legal lexical file number
Since:
JWI 2.1.0

isIllegalLexicalFileNumber

public static boolean isIllegalLexicalFileNumber(int num)
Returns true if the number represents a valid lexical file number, namely, a number in in the closed range [0, 99]; returns false otherwise.

Parameters:
num - the number to be checked
Returns:
true if the number represents a valid lexical file number, namely, a number in in the closed range [0, 99]; returns false otherwise.
Since:
JWI 2.1.0

getLexicalFileNumberString

public static java.lang.String getLexicalFileNumberString(int num)
Returns a two-character string representation of a lexical file number, zero-filled if necessary. This string is suitable for inclusion in Wordnet-formatted files.

Parameters:
num - the number to be represented
Returns:
a two-character string representing the number
Throws:
java.lang.IllegalArgumentException - if the specified integer is not a legal lexical file number
Since:
JWI 2.1.0

values

public static java.util.Collection<LexFile> values()
Emulates the Enum#values() function. Returns an unmodifiable collection of all the lexical file descriptions declared in this class, in the order they are declared.

Returns:
returns an unmodifiable collection of the lexical file description declared in this class
Since:
JWI 2.1.0

getLexicalFile

public static LexFile getLexicalFile(int num)
A convenience method that allows retrieval of one of the built-in lexical file descriptions given the number. If no such description exists, then the method returns null.

Parameters:
num - the number for the lexical file object
Returns:
ILexFile the lexical file corresponding to the specified tag, or null if none is found
Since:
JWI 2.1.0


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