T - the type of object for the content typepublic class DataType<T> extends Object implements IDataType<T>
IDataType interface. This class
provides the data 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.| Modifier and Type | Field and Description |
|---|---|
static DataType<ISynset> |
DATA |
static DataType<IExceptionEntryProxy> |
EXCEPTION |
static DataType<IIndexWord> |
INDEX |
static DataType<ISenseEntry> |
SENSE |
| Constructor and Description |
|---|
DataType(String userFriendlyName,
boolean hasVersion,
ILineParser<T> parser,
Collection<String> hints)
Constructs a new data type.
|
DataType(String userFriendlyName,
boolean hasVersion,
ILineParser<T> parser,
String... hints)
Constructs a new data type.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsOneOf(String target,
Set<String> patterns)
Checks to see if one of the string patterns specified in the set of
strings is found in the specified target string.
|
static File |
find(IDataType<?> type,
POS pos,
Collection<? extends File> files)
Finds the first file that satisfies the naming constraints of both
the data type and part of speech.
|
ILineParser<T> |
getParser()
Returns the line parser that can be used to process lines of data
retrieved from an
IDataSource file with this type. |
Set<String> |
getResourceNameHints()
Returns an immutable set of strings that can be used as keywords to
identify resources that are of this type.
|
boolean |
hasVersion()
Indicates whether this content type usually has wordnet version
information encoded in its header.
|
String |
toString() |
static Collection<DataType<?>> |
values()
Emulates the Enum.values() function.
|
public static final DataType<IIndexWord> INDEX
public static final DataType<IExceptionEntryProxy> EXCEPTION
public static final DataType<ISenseEntry> SENSE
public DataType(String userFriendlyName, boolean hasVersion, ILineParser<T> parser, String... hints)
userFriendlyName - a user-friendly name, for easy identification of this data
type; may be nullhasVersion - true if the comment header for this data type
usually contains a version numberparser - the line parser for transforming lines from this data type
into objects; may not be nullhints - a varargs array of resource name hints for identifying the
resource that contains the data. may be null, but
may not contain nullNullPointerException - if the specified parser is nullpublic DataType(String userFriendlyName, boolean hasVersion, ILineParser<T> parser, Collection<String> hints)
userFriendlyName - a user-friendly name, for easy identification of this data
type; may be nullhasVersion - true if the comment header for this data type
usually contains a version numberparser - the line parser for transforming lines from this data type
into objects; may not be nullhints - a collection of resource name hints for identifying the
resource that contains the data. May be null, but
may not contain nullNullPointerException - if the specified parser is nullpublic boolean hasVersion()
IDataTypehasVersion in interface IDataType<T>true if the content file that underlies this content
usually has wordnet version information in its comment header;
false otherwise.public Set<String> getResourceNameHints()
IDataTypegetResourceNameHints in interface IDataType<T>public ILineParser<T> getParser()
IDataTypeIDataSource file with this type.public static Collection<DataType<?>> values()
public static File find(IDataType<?> type, POS pos, Collection<? extends File> files)
type - the data type whose resource name hints should be used, may
not be nullpos - the part of speech whose resource name hints should be used,
may be nullfiles - the files to be search, may be empty but not nullnull if none is found.NullPointerException - if the data type or file collection is nullpublic static boolean containsOneOf(String target, Set<String> patterns)
true. If a pattern is found in the
target string, returns true. Otherwise, returns
false.target - the string to be searchedpatterns - the patterns to search fortrue if the target contains one of the patterns;
false otherwiseCopyright © 2018. All rights reserved.