|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FsVariables
Implements cross-annotator named feature structure variables.
To use, a certain type and index must be declared in the processing pipeline. Use the type system and index declaration that come with this package. There's also an annotator descriptor that shows you how to import the type system and index specification into your own descriptor.
Use FsVariableFactory.newInstance()
to create a
FsVariables
object. On every process call to your annotator (or whenever there's
a new CAS; you can use this in other places than just annotators), you need to call
init(CAS)
to re-initialize the object to the next CAS.
Field Summary | |
---|---|
static java.lang.String |
INDEX_NAME
|
static java.lang.String |
NAME_FEATURE_NAME
|
static java.lang.String |
TYPE_FEATURE_NAME
|
static java.lang.String |
TYPE_NAME
|
static java.lang.String |
VALUE_FEATURE_NAME
|
Method Summary | |
---|---|
boolean |
checkCas(org.apache.uima.cas.CAS cas)
Check a CAS for FsVariable type system and index definition. |
void |
declareFsVariable(java.lang.String name,
org.apache.uima.cas.Type type)
Declare a new FsVariable. |
org.apache.uima.cas.Type |
getFsVariableType(java.lang.String name)
Get the type of an FsVariable. |
org.apache.uima.cas.FeatureStructure |
getVariableValue(java.lang.String name)
Get the FeatureStructure value of a variable. |
void |
init(org.apache.uima.cas.CAS cas)
Initialize this with current CAS. |
boolean |
isFsVariable(java.lang.String name)
Check if a variable of that name exists. |
java.util.List |
listFsVariables()
Return a list of all variable names that are currently declared. |
java.util.List |
listFsVariables(org.apache.uima.cas.Type type)
Return a list of all variable names of those variables whose type is a subtype of the type parameter. |
void |
setVariable(java.lang.String name,
org.apache.uima.cas.FeatureStructure fs)
Set the value of an existing variable. |
Field Detail |
---|
static final java.lang.String INDEX_NAME
static final java.lang.String TYPE_NAME
static final java.lang.String NAME_FEATURE_NAME
static final java.lang.String TYPE_FEATURE_NAME
static final java.lang.String VALUE_FEATURE_NAME
Method Detail |
---|
boolean checkCas(org.apache.uima.cas.CAS cas)
true
,
init(CAS)
will not throw an exception.
cas
- The CAS to check.
true
iff CAS contains required type and index.void init(org.apache.uima.cas.CAS cas) throws FsVariablesException
this
with current CAS. This needs to be called on every process, before
any other APIs are called!
cas
- The current CAS.
FsVariablesException
- When the CAS does not contain FsVariable type or index.void declareFsVariable(java.lang.String name, org.apache.uima.cas.Type type) throws FsVariablesException
isFsVariable(String)
to check if a variable with the same name
already exists.
name
- The name of the variable.type
- The type of the variable.
FsVariablesException
- When FsVariable name
already exists.boolean isFsVariable(java.lang.String name)
name
- The name of the variable.
true
iff a FsVariable of that name exists.org.apache.uima.cas.Type getFsVariableType(java.lang.String name) throws FsVariablesException
name
- The name of the variable.
FsVariablesException
- If no variable of that name exists, or somehow the name of the
variable's type does not resolve to a type in the type system.java.util.List listFsVariables()
java.util.List listFsVariables(org.apache.uima.cas.Type type)
type
- The type of variables we want to see.
org.apache.uima.cas.FeatureStructure getVariableValue(java.lang.String name) throws FsVariablesException
name
- The name of the variable.
FsVariablesException
- When no variable of name
exists.void setVariable(java.lang.String name, org.apache.uima.cas.FeatureStructure fs) throws FsVariablesException
name
- The name of the variable.fs
- The value to set.
FsVariablesException
- When no variable of name
exists.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |