edu.mit.jwi.data
Class ContentType<T>

java.lang.Object
  extended by edu.mit.jwi.data.ContentType<T>
Type Parameters:
T - the type of object for the content type
All Implemented Interfaces:
IContentType<T>, IHasCharset, IHasPOS

public class ContentType<T>
extends java.lang.Object
implements IContentType<T>

A concrete implementation of the IContentType interface. This class provides the content types necessary for Wordnet in the form of static fields. It is not implemented as an Enum so that clients may add their own content types by instantiating this class.

Since:
JWI 2.0.0
Version:
2.4.0
Author:
Mark A. Finlayson

Field Summary
static ContentType<ISynset> DATA_ADJECTIVE
           
static ContentType<ISynset> DATA_ADVERB
           
static ContentType<ISynset> DATA_NOUN
           
static ContentType<ISynset> DATA_VERB
           
static ContentType<IExceptionEntryProxy> EXCEPTION_ADJECTIVE
           
static ContentType<IExceptionEntryProxy> EXCEPTION_ADVERB
           
static ContentType<IExceptionEntryProxy> EXCEPTION_NOUN
           
static ContentType<IExceptionEntryProxy> EXCEPTION_VERB
           
static ContentType<IIndexWord> INDEX_ADJECTIVE
           
static ContentType<IIndexWord> INDEX_ADVERB
           
static ContentType<IIndexWord> INDEX_NOUN
           
static ContentType<IIndexWord> INDEX_VERB
           
static ContentType<ISenseEntry> SENSE
           
 
Constructor Summary
ContentType(IDataType<T> type, POS pos, ILineComparator comparator)
          Constructs a new ContentType
ContentType(IDataType<T> type, POS pos, ILineComparator comparator, java.nio.charset.Charset charset)
          Constructs a new ContentType
 
Method Summary
 java.nio.charset.Charset getCharset()
          Returns the character set associated with this object.
static IContentType<ISynset> getDataContentType(POS pos)
          Use this convenience method to retrieve the appropriate ISynset content type for the specified POS.
 IDataType<T> getDataType()
          Returns the assigned resource type of this object.
static IContentType<IExceptionEntryProxy> getExceptionContentType(POS pos)
          Use this convenience method to retrieve the appropriate IExceptionEntryProxy content type for the specified POS.
static IContentType<IIndexWord> getIndexContentType(POS pos)
          Use this convenience method to retrieve the appropriate IIndexWord content type for the specified POS.
 ILineComparator getLineComparator()
          Returns a comparator that can be used to determine ordering between different lines of data in the resource.
 POS getPOS()
          Returns the associated part of speech for this object.
 java.lang.String toString()
           
static java.util.Collection<ContentType<?>> values()
          Emulates the Enum.values() function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INDEX_NOUN

public static final ContentType<IIndexWord> INDEX_NOUN

INDEX_VERB

public static final ContentType<IIndexWord> INDEX_VERB

INDEX_ADVERB

public static final ContentType<IIndexWord> INDEX_ADVERB

INDEX_ADJECTIVE

public static final ContentType<IIndexWord> INDEX_ADJECTIVE

DATA_NOUN

public static final ContentType<ISynset> DATA_NOUN

DATA_VERB

public static final ContentType<ISynset> DATA_VERB

DATA_ADVERB

public static final ContentType<ISynset> DATA_ADVERB

DATA_ADJECTIVE

public static final ContentType<ISynset> DATA_ADJECTIVE

EXCEPTION_NOUN

public static final ContentType<IExceptionEntryProxy> EXCEPTION_NOUN

EXCEPTION_VERB

public static final ContentType<IExceptionEntryProxy> EXCEPTION_VERB

EXCEPTION_ADVERB

public static final ContentType<IExceptionEntryProxy> EXCEPTION_ADVERB

EXCEPTION_ADJECTIVE

public static final ContentType<IExceptionEntryProxy> EXCEPTION_ADJECTIVE

SENSE

public static final ContentType<ISenseEntry> SENSE
Constructor Detail

ContentType

public ContentType(IDataType<T> type,
                   POS pos,
                   ILineComparator comparator)
Constructs a new ContentType

Parameters:
type - the data type for this content type, may not be null
pos - the part of speech for this content type; may be null if the content type has no natural part of speech
comparator - the line comparator for this content type; may be null if the lines are not ordered
Since:
JWI 2.0.0

ContentType

public ContentType(IDataType<T> type,
                   POS pos,
                   ILineComparator comparator,
                   java.nio.charset.Charset charset)
Constructs a new ContentType

Parameters:
type - the data type for this content type, may not be null
pos - the part of speech for this content type; may be null if the content type has no natural part of speech
comparator - the line comparator for this content type; may be null if the lines are not ordered
charset - the character set for this content type, may be null
Since:
JWI 2.3.4
Method Detail

getDataType

public IDataType<T> getDataType()
Description copied from interface: IContentType
Returns the assigned resource type of this object. This method may not return null

Specified by:
getDataType in interface IContentType<T>
Returns:
the data type object representing the resource type for this content type

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.

getLineComparator

public ILineComparator getLineComparator()
Description copied from interface: IContentType
Returns a comparator that can be used to determine ordering between different lines of data in the resource. This is used for searching. If the data in the resource is not ordered, then this method returns null.

Specified by:
getLineComparator in interface IContentType<T>
Returns:
a comparator that imposes an ordering on the lines in the data file; or null if there is no comparator

getCharset

public java.nio.charset.Charset getCharset()
Description copied from interface: IHasCharset
Returns the character set associated with this object. May be null.

Specified by:
getCharset in interface IHasCharset
Returns:
the Charset associated this object, possibly null

toString

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

values

public static java.util.Collection<ContentType<?>> values()
Emulates the Enum.values() function.

Returns:
all the static ContentType instances listed in the class, in the order they are declared.
Since:
JWI 2.0.0

getIndexContentType

public static IContentType<IIndexWord> getIndexContentType(POS pos)
Use this convenience method to retrieve the appropriate IIndexWord content type for the specified POS.

Parameters:
pos - the part of speech for the content type, may not be null
Returns:
the index content type for the specified part of speech
Throws:
java.lang.NullPointerException - if the specified part of speech is null
Since:
JWI 2.0.0

getDataContentType

public static IContentType<ISynset> getDataContentType(POS pos)
Use this convenience method to retrieve the appropriate ISynset content type for the specified POS.

Parameters:
pos - the part of speech for the content type, may not be null
Returns:
the index content type for the specified part of speech
Throws:
java.lang.NullPointerException - if the specified part of speech is null
Since:
JWI 2.0.0

getExceptionContentType

public static IContentType<IExceptionEntryProxy> getExceptionContentType(POS pos)
Use this convenience method to retrieve the appropriate IExceptionEntryProxy content type for the specified POS.

Parameters:
pos - the part of speech for the content type, may not be null
Returns:
the index content type for the specified part of speech
Throws:
java.lang.NullPointerException - if the specified part of speech is null
Since:
JWI 2.0.0


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