|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.languagecomputer.api.text.DefaultText com.languagecomputer.api.text.DefaultAttribute
public class DefaultAttribute
Default implementation of an Attribute
.
Field Summary |
---|
Fields inherited from interface com.languagecomputer.api.text.Attribute |
---|
TYPE |
Constructor Summary | |
---|---|
DefaultAttribute()
Creates a new DefaultAttribute . |
Method Summary | |
---|---|
void |
addRole(String roleName,
Text text)
Adds a role instance to this Attribute . |
Set<String> |
getAvailableRoles()
Returns the set role types that are available for this Attribute instance. |
Collection<Text> |
getRoles(String roleName)
Returns the Text of the role instances for this
Attribute with the given roleName. |
String |
getType()
Returns the type of this Attribute . |
void |
setAnnotationType(AnnotationType annType)
Not necessary: defaults to Attribute.TYPE . |
void |
setType(String type)
Sets the type of this Attribute . |
String |
toString()
Returns a String representation of a
DefaultAttribute . |
Methods inherited from class com.languagecomputer.api.text.DefaultText |
---|
getAnnotationType, getCongruentAnnotations, getDocument, getDocumentID, getEndCharOffset, getIntersectingAnnotations, getRawString, getStartCharOffset, getSubAnnotations, getSuperAnnotations, setDocument, setEndCharOffset, setRawString, setStartCharOffset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.languagecomputer.api.text.Text |
---|
getAnnotationType, getCongruentAnnotations, getDocument, getDocumentID, getEndCharOffset, getIntersectingAnnotations, getRawString, getStartCharOffset, getSubAnnotations, getSuperAnnotations |
Constructor Detail |
---|
public DefaultAttribute()
DefaultAttribute
.
Method Detail |
---|
public void setAnnotationType(AnnotationType annType)
Attribute.TYPE
.
setAnnotationType
in class DefaultText
annType
- AnnotationType
to use for this
DefaultAttribute
.Text.getAnnotationType()
,
AnnotationType
public void setType(String type)
Attribute
.
type
- Name for this type of DefaultAttribute
.Attribute.getType()
public String getType()
Attribute
.
getType
in interface Attribute
Attribute
's type (or name).public void addRole(String roleName, Text text)
Attribute
. If the Text
is null
, then the role name will be added but the
text will be ignored.
roleName
- Name for this new role instance.text
- Text
span for this new role instance.
IllegalArgumentException
- If the roleName is
null
.getAvailableRoles()
,
getRoles(String)
public Set<String> getAvailableRoles()
Attribute
instance. There may be more types of roles for this
type of attribute, but this method will only return the types of roles that
it knows about. Furthermore, it is not guaranteed that all available roles
have an instance of that role attached to this Attribute
. In
other words, if a system knows all the possible role names, it may return
them here even if not all the roles are found within this
Attribute
, but the caller should also be able to handle
the case where this Attribute
only knows about the role names
based on what roles objects are actually attached to it.
getAvailableRoles
in interface Attribute
Set
of role names that are known to this
Attribute
instance.public Collection<Text> getRoles(String roleName)
Text
of the role instances for this
Attribute
with the given roleName. For many roles,
this will be a singleton Collection
, but having multiple roles
of the same type is supported as well.
getRoles
in interface Attribute
roleName
- The name of the role to get the instances of.
Collection
of Text
s for all the roles
instances associated with this Attribute
with the given
roleName, or an empty Collection
if none exist.public String toString()
String
representation of a
DefaultAttribute
.
toString
in class DefaultText
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |