T - the type of object represented in this data resourcepublic interface IDataSource<T> extends IHasVersion, Iterable<String>, IHasLifecycle
An object that mediate between an IDataSourceDictionary and the data
that is contained in the dictionary data resources. Data resources are
assigned a name (e.g., verb.data, for the data resource pertaining to
verbs) and a content type. Data resources are assumed to be indexed by keys
that can be passed into the getLine(String) method to find a
particular piece of data in the resource. The String return can
be parsed by the parser associated with the content type to produce a data
object (e.g., an ISynset or IIndexWord object).
The iterator produced by this class should not support the
Iterator.remove() operation; if that method is called, the iterator
will throw an UnsupportedOperationException.
IHasLifecycle.LifecycleState, IHasLifecycle.ObjectClosedException, IHasLifecycle.ObjectOpenException| Modifier and Type | Method and Description |
|---|---|
IContentType<T> |
getContentType()
Returns the assigned content type of the resource that backs this object.
|
String |
getLine(String key)
Returns the line in the resource contains the data indexed by the
specified key.
|
String |
getName()
Returns a string representation of the name of this resource.
|
Iterator<String> |
iterator(String key)
Returns an iterator that will iterator over lines in the data resource,
starting at the line specified by the given key.
|
getVersionforEach, iterator, spliteratorisOpen, openString getName()
null, empty, or
all whitespaceIContentType<T> getContentType()
null.String getLine(String key)
nullkey - the key which indexes the desired dataNullPointerException - if the specified key is nullIterator<String> iterator(String key)
null, this is the same as calling the plain
Iterable.iterator() method. If no line starts with the pattern, the
iterator's Iterator.hasNext() will return false. The
iterator does not support the Iterator.remove() operation; if
that method is called, the iterator will throw an
UnsupportedOperationException.key - the key at which the iterator should beginCopyright © 2018. All rights reserved.