|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.mit.jverbnet.util.AbstractHasLifecycle
edu.mit.jverbnet.index.VerbIndex
public class VerbIndex
Default implementation of the IVerbIndex interface.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface edu.mit.jverbnet.util.IHasLifecycle |
|---|
IHasLifecycle.ObjectClosedException |
| Constructor Summary | |
|---|---|
VerbIndex(File file)
Creates a new verb index that uses the data at the specified location. |
|
VerbIndex(URL url)
Creates a new verb index that uses the data at the specified location. |
|
| Method Summary | ||
|---|---|---|
protected
|
compressAndMakeUnmodifiable(Map<K,Set<V>> map)
Utility method for reallocating and making unmodifiable a map of sets. |
|
protected IVersion |
determineVersion()
Determines the version of verbnet, as best is able. |
|
protected void |
doClose()
Subclasses should put tear-down, closing code in this method. |
|
protected boolean |
doIsOpen()
Subclasses should put code that determines whether the object is open in here. |
|
protected boolean |
doOpen()
Subclasses should put initialization code in this method. |
|
Set<IMember> |
getMembers(IWordnetKey key)
Returns all members in the index with the specified wordnet key. |
|
Set<IMember> |
getMembers(String grouping)
Returns all members in the index with the specified grouping. |
|
IVerbClass |
getRootVerb(String id)
Returns the root verb class with the specified id, or null if no
such verb class can be found in the index. |
|
protected
|
getSetForKey(Map<K,Set<V>> map,
K key)
Utility method for filling in a map of keys to sets. |
|
IVerbClass |
getVerb(String id)
Returns the verb class with the specified id, or null if no
such verb class can be found in the index. |
|
IVersion |
getVersion()
The version of the index. |
|
protected Map<String,IVerbClass> |
initVerbByIdMap()
Initialization code for reading the verbnet XML. |
|
Iterator<IVerbClass> |
iterator()
Returns an iterator over all verb classes in the index, in the order they are encountered in the data files. |
|
Iterator<String> |
iteratorGroups()
Returns an iterator over all groupings in the index, in their natural order. |
|
Iterator<IVerbClass> |
iteratorRoots()
Returns an iterator over all root verb classes in the index, in the order they are encountered in the data files. |
|
Iterator<IWordnetKey> |
iteratorWordnetKeys()
Returns an iterator over all wordnet keys in the index, in their natural order. |
|
protected boolean |
parse(XMLReader parser,
InputStream in,
String filename)
Parses an XML input stream. |
|
void |
setErrorHandler(ErrorHandler eh)
Sets the XML error handler that will be used by the index when parsing XML files. |
|
| Methods inherited from class edu.mit.jverbnet.util.AbstractHasLifecycle |
|---|
checkOpen, close, isOpen, open |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface edu.mit.jverbnet.util.IHasLifecycle |
|---|
close, isOpen, open |
| Constructor Detail |
|---|
public VerbIndex(File file)
file - the file or directory containing the verbnet datapublic VerbIndex(URL url)
url - the file or directory containing the verbnet data| Method Detail |
|---|
public IVersion getVersion()
IVerbIndexIVersion.UNKNOWN.
getVersion in interface IVerbIndexIVersion.UNKNOWNprotected IVersion determineVersion()
IVersion.UNKNOWN.
IVersion.UNKNOWN
protected boolean doOpen()
throws IOException
AbstractHasLifecyclefalse or throw an exception. The abstract
lifecycle object takes care of calling the AbstractHasLifecycle.doClose() method if
initialization fails.
doOpen in class AbstractHasLifecycletrue if initialization succeeds; false
otherwise
IOException - if there is an IO error while initializingpublic void setErrorHandler(ErrorHandler eh)
eh - the error handler to be used; may be null
protected Map<String,IVerbClass> initVerbByIdMap()
throws IOException
IOException - if there is an IO error
protected boolean parse(XMLReader parser,
InputStream in,
String filename)
throws IOException
parser - the parser to use; may not be nullin - the input stream from which to read the data
true if the parse failed and the initialization
should halt; false otherwise
IOException - if there is an IO error when parsing
{@link - NullPointerException} if the parser or input stream are
null
protected <K,V> Set<V> getSetForKey(Map<K,Set<V>> map,
K key)
map - the map to query for the set indexed by the keykey - the key under which to look for the set
nullprotected <K,V> Map<K,Set<V>> compressAndMakeUnmodifiable(Map<K,Set<V>> map)
map - the map whose set values should be reallocated and made
unmodifiable; the map itself is made unmodifiable
protected boolean doIsOpen()
AbstractHasLifecycletrue if the object is open; false
otherwise.
doIsOpen in class AbstractHasLifecycletrue if the object is open; false
otherwise.protected void doClose()
AbstractHasLifecycleAbstractHasLifecycle.open() the
object.
doClose in class AbstractHasLifecyclepublic IVerbClass getVerb(String id)
IVerbIndexnull if no
such verb class can be found in the index. Ids are usually of the form
'verb-##.#', e.g., 'accompany-51.7'.
getVerb in interface IVerbIndexid - the id of the class
null if nonepublic IVerbClass getRootVerb(String id)
IVerbIndexnull if no
such verb class can be found in the index. Ids are usually of the form
'verb-##.#', e.g., 'accompany-51.7'.
getRootVerb in interface IVerbIndexid - the id of the class
null if nonepublic Set<IMember> getMembers(IWordnetKey key)
IVerbIndexnull key indicates all members that have no key specified.
getMembers in interface IVerbIndexkey - the key for which members should be retrieved; may be
null
nullpublic Set<IMember> getMembers(String grouping)
IVerbIndexnull, empty, or all whitespace grouping indicates all
members that have no grouping specified.
getMembers in interface IVerbIndexgrouping - the grouping for which members should be retrieved; may be
null, empty, or all whitespace.
nullpublic Iterator<IVerbClass> iterator()
IVerbIndex
iterator in interface IVerbIndexiterator in interface Iterable<IVerbClass>public Iterator<IVerbClass> iteratorRoots()
IVerbIndex
iteratorRoots in interface IVerbIndexpublic Iterator<IWordnetKey> iteratorWordnetKeys()
IVerbIndex
iteratorWordnetKeys in interface IVerbIndexpublic Iterator<String> iteratorGroups()
IVerbIndex
iteratorGroups in interface IVerbIndex
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||