public class XcasAnnotation extends java.lang.Object implements java.lang.Cloneable, java.lang.Comparable<XcasAnnotation>
XcasAnnotation
object represents an element under the CAS
tag in an XCAS file. It provides members and methods to store and access
its type, attributes,and references.
Note: this class has a natural ordering that is inconsistent with equals.
It is strongly recommended that the use of compareTo(XcasAnnotation)
be strictly limited to the purpose of an orderly display of multiple objects.
Modifier and Type | Class and Description |
---|---|
private class |
XcasAnnotation.MyVector |
Modifier and Type | Field and Description |
---|---|
protected java.util.Hashtable<java.lang.String,java.lang.String> |
attributes |
protected java.util.Hashtable<java.lang.String,XcasAnnotation.MyVector> |
references |
protected java.util.Hashtable<java.lang.String,java.util.Vector<java.lang.Integer>> |
refIntArrays |
protected java.lang.String |
type |
Constructor and Description |
---|
XcasAnnotation()
Default constructor.
|
XcasAnnotation(java.lang.String t)
Constructs an object with the specified type.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
allFieldsValues()
Returns a string representation of all the attributes and references.
|
java.lang.Object |
clone()
Recursive, deep copy of this object, including attributes and references.
|
int |
compareTo(XcasAnnotation o)
Determines the order of this and the specified
XcasAnnotation . |
java.lang.String |
description()
Returns a String representation of this object, including its type, and
all attributes and references.
|
boolean |
equals(java.lang.Object obj)
Determines whether the specified object equals to this one.
|
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the specified attribute.
|
java.util.Vector<XcasAnnotation> |
getReference(java.lang.String name)
Returns the referenced
XcasAnnotation s of the specified attribute. |
java.lang.String |
getType() |
void |
insertAttribute(java.lang.String k,
java.lang.String v)
Inserts an (attribute, value) pair to this
XcasAnnotation . |
void |
insertIntReference(java.lang.String k,
int[] a) |
void |
insertReference(java.lang.String k,
XcasAnnotation a) |
private XcasAnnotation |
prepareCopy()
Clones this object and its attributes, but leave references blank.
|
void |
setType(java.lang.String t)
Sets the type name of this annotation.
|
XcasAnnotation |
shallowCopy()
Clones this object, its attributes, and reference keys.
|
java.lang.String |
shortType()
Returns a short description of this
XcasAnnotation 's type,
specifically, the last segment as separated by dots. |
protected java.lang.String type
protected java.util.Hashtable<java.lang.String,java.lang.String> attributes
protected java.util.Hashtable<java.lang.String,XcasAnnotation.MyVector> references
protected java.util.Hashtable<java.lang.String,java.util.Vector<java.lang.Integer>> refIntArrays
public XcasAnnotation()
public XcasAnnotation(java.lang.String t)
t
- Type of the XcasAnnotation
object to be created.public void setType(java.lang.String t)
t
- Type to be set.public void insertAttribute(java.lang.String k, java.lang.String v)
XcasAnnotation
.k
- Name of the attribute.v
- Value of the attribute.public void insertReference(java.lang.String k, XcasAnnotation a)
public void insertIntReference(java.lang.String k, int[] a)
public java.lang.String getAttribute(java.lang.String name)
name
- Name of the attribute.public java.util.Vector<XcasAnnotation> getReference(java.lang.String name)
XcasAnnotation
s of the specified attribute.name
- Name of an attribute that references to other XcasAnnotation
.HashSet
of referenced public boolean equals(java.lang.Object obj)
XcasAnnotation a
equals to another one o
if and only if o
is also an XcasAnnotation
object
and a.type.equals(o.type) && a.attributes.equals(o.attributes) &&
a.references.equals(o.references)
.equals
in class java.lang.Object
obj
- An object to compare with this one.true
if the specified object equals this one,
false
otherwise.public java.lang.String getType()
public java.lang.String shortType()
XcasAnnotation
's type,
specifically, the last segment as separated by dots.public java.lang.String allFieldsValues()
public java.lang.String description()
private final XcasAnnotation prepareCopy()
public java.lang.Object clone()
clone
in class java.lang.Object
public final XcasAnnotation shallowCopy()
public int compareTo(XcasAnnotation o)
XcasAnnotation
.
Note: It is strongly recommended that the use of this method be strictly
limited to the purpose of an orderly display of multiple objects.
To determine the equality of two objects, use equals(Object)
.compareTo
in interface java.lang.Comparable<XcasAnnotation>
equals(Object)