public class FilteredTreebank extends AbstractTreebank implements DerivedTreebank
Modifier and Type | Field and Description |
---|---|
protected Treebank |
base |
static java.lang.String |
BASE_ID_PROPERTY |
protected java.lang.String |
baseTreebankId |
protected int[] |
filter |
changeListeners, eventSource, location, name, properties
Constructor and Description |
---|
FilteredTreebank() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.lang.String eventName,
de.ims.icarus.ui.events.EventListener listener) |
FilteredTreebank |
derive(int[] filter) |
static FilteredTreebank |
filterTreebank(Treebank base,
int[] filter) |
void |
free()
|
SentenceData |
get(int index,
DataType type)
Synchronously fetches the
SentenceData object
for the specified index. |
SentenceData |
get(int index,
DataType type,
AvailabilityObserver observer)
Asynchronously fetches the
SentenceData object
for the specified index. |
Treebank |
getBase() |
de.ims.icarus.util.data.ContentType |
getContentType() |
int[] |
getFilter() |
TreebankMetaData |
getMetaData() |
boolean |
isLoaded() |
boolean |
isLoading() |
void |
load()
Loads this
Treebank . |
void |
loadState(TreebankDescriptor descriptor) |
void |
remove(int index,
DataType type)
Removes from this
Treebank the data stored at the
specified index that is associated with the given
type . |
void |
removeListener(de.ims.icarus.ui.events.EventListener listener) |
void |
removeListener(de.ims.icarus.ui.events.EventListener listener,
java.lang.String eventName) |
void |
saveState(TreebankDescriptor descriptor) |
void |
set(SentenceData item,
int index,
DataType type)
Replaces
|
void |
setBase(Treebank base) |
void |
setFilter(int[] filter) |
int |
size() |
boolean |
supportsType(DataType type) |
addChangeListener, destroy, fireChangeEvent, get, getDescription, getIcon, getId, getLocation, getName, getOwner, getProperties, getProperty, isDestroyed, isEditable, removeChangeListener, setLocation, setName, setProperty, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
destroy, getLocation, getProperties, getProperty, isDestroyed, isEditable, setLocation, setName, setProperty
public static final java.lang.String BASE_ID_PROPERTY
protected transient Treebank base
protected java.lang.String baseTreebankId
protected int[] filter
public Treebank getBase()
getBase
in interface DerivedTreebank
public void setBase(Treebank base)
setBase
in interface DerivedTreebank
public de.ims.icarus.util.data.ContentType getContentType()
getContentType
in interface de.ims.icarus.util.data.DataContainer
getContentType
in interface de.ims.icarus.util.data.DataList<SentenceData>
public boolean isLoaded()
public void load() throws java.lang.Exception
Treebank
Treebank
. In a typical synchronous
implementation this method will cover the entire
loading process and return once all data is loaded.
For asynchronous implementations this method returns
immediately and actual loading is done in a background
thread.public int size()
size
in interface de.ims.icarus.util.data.DataList<SentenceData>
public void saveState(TreebankDescriptor descriptor)
saveState
in interface Treebank
saveState
in class AbstractTreebank
AbstractTreebank.saveState(de.ims.icarus.language.treebank.TreebankDescriptor)
public void loadState(TreebankDescriptor descriptor)
loadState
in interface Treebank
loadState
in class AbstractTreebank
AbstractTreebank.loadState(de.ims.icarus.language.treebank.TreebankDescriptor)
public int[] getFilter()
public void setFilter(int[] filter)
filter
- the filter to setpublic FilteredTreebank derive(int[] filter)
public static FilteredTreebank filterTreebank(Treebank base, int[] filter)
public void free()
Treebank
free
in interface de.ims.icarus.io.Loadable
free
in interface Treebank
free
in class AbstractTreebank
public TreebankMetaData getMetaData()
getMetaData
in interface Treebank
Treebank.getMetaData()
public void addListener(java.lang.String eventName, de.ims.icarus.ui.events.EventListener listener)
addListener
in interface Treebank
addListener
in class AbstractTreebank
EventSource.addListener(java.lang.String, de.ims.icarus.ui.events.EventListener)
public void removeListener(de.ims.icarus.ui.events.EventListener listener)
removeListener
in interface Treebank
removeListener
in class AbstractTreebank
EventSource.removeEventListener(de.ims.icarus.ui.events.EventListener)
public void removeListener(de.ims.icarus.ui.events.EventListener listener, java.lang.String eventName)
removeListener
in interface Treebank
removeListener
in class AbstractTreebank
EventSource.removeEventListener(de.ims.icarus.ui.events.EventListener, java.lang.String)
public void set(SentenceData item, int index, DataType type)
Treebank
set
in interface Treebank
set
in class AbstractTreebank
Treebank.set(de.ims.icarus.language.SentenceData, int, de.ims.icarus.language.DataType)
public void remove(int index, DataType type)
Treebank
Treebank
the data stored at the
specified index
that is associated with the given
type
. The exact behavior in case of the type
argument being null
is implementation specific. The general
advice is to remove all data stored for that index, but implementations
might decide to ignore calls without a valid DataType
parameter.
In addition an implementation can remove all data for that index if
data of some important type was removed. I.e. a typical Treebank
representing parse or other annotation results created by an automated
process would drop an entire index when data of the type
is removed.remove
in interface Treebank
remove
in class AbstractTreebank
Treebank.remove(int, de.ims.icarus.language.DataType)
public boolean supportsType(DataType type)
supportsType
in interface SentenceDataList
SentenceDataList.supportsType(de.ims.icarus.language.DataType)
public SentenceData get(int index, DataType type)
SentenceDataList
SentenceData
object
for the specified index. If this list
supports
asynchronous loading of elements then this method may
return null
if the desired index
is not
available.get
in interface SentenceDataList
index
- the index of interestSentenceData
object at position index
within this list
SentenceDataList.get(int, de.ims.icarus.language.DataType)
public SentenceData get(int index, DataType type, AvailabilityObserver observer)
SentenceDataList
SentenceData
object
for the specified index.
This method might return null
and use the optional
AvailabilityObserver
to notify about a successful loading
of the desired data later. Implementations should only
store a weak reference to the provided observer
since
the calling code might decide to release the AvailabilityObserver
object and its associated resources while the loading is
still in progress. Therefore exclusive ownership of this object
should be left to the original code that created it.
get
in interface SentenceDataList
index
- the index of interesttype
- the type to fetch an entry forobserver
- the AvailabilityObserver
to be notified
when the asynchronous loading of the desired SentenceData
is finishedSentenceDataList.get(int, de.ims.icarus.language.DataType, de.ims.icarus.language.AvailabilityObserver)
public boolean isLoading()
isLoading
in interface de.ims.icarus.io.Loadable
Loadable.isLoading()