|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.annotation.util.FeatureMap org.annotation.wordfreak.Annotation
Class for storing annotations. Annotations minimally need offsets (a span) and the tree structure in which they are organized. They typically also have features for their type, annotator, and confidence.
Field Summary | |
static java.lang.String |
ANNOTATOR
The name of the annotator property. |
static java.lang.String |
COMMENT
The name of the comment property. |
static java.lang.String |
CONFIDENCE
The name of the confidence property. |
static Annotation[] |
EMPTY_ARRAY
|
static java.lang.String |
EMPTY_SPAN_STRING
The string that will be displayed for traces and other null elements |
static java.lang.String |
ID
The name of the ID property. |
static java.lang.String |
LABEL
The name of the type property. |
static org.annotation.wordfreak.NoFileComparator |
NOFILECOMPARATOR
Used to sort annotations without caring about the file they are from. |
static org.annotation.wordfreak.OffsetComparator |
OFFSETCOMPARATOR
|
static java.lang.String |
ORDER
|
static java.lang.String |
SPAN
The name of the span property. |
static org.annotation.wordfreak.SpanComparator |
SPANCOMPARATOR
|
static java.lang.String |
TYPE
The name of the type property. |
Fields inherited from class org.annotation.util.FeatureMap |
DEFAULT_SET_DELIMITER, properties |
Constructor Summary | |
Annotation(AnnotationTree t,
Annotation a)
Copies the specified annotation creating a new annotation with identical properties with the specified tree. |
|
Annotation(AnnotationTree tree,
Span span)
Creates a new annotation with the given tree and span. |
|
Annotation(AnnotationTree tree,
Span span,
Annotation[] children)
Creates a new annotatinon with the given tree and children. |
|
Annotation(AnnotationTree tree,
Span s,
java.util.List children)
Creates a new annotation with the given tree and children. |
|
Annotation(AnnotationTree tree,
Span span,
java.util.List children,
java.lang.String type,
java.lang.String annotator,
double confidence)
Creates a new annotation with the given tree, children, type, annotator and confidence. |
|
Annotation(AnnotationTree tree,
Span span,
java.lang.String type,
java.lang.String annotator,
double confidence)
Creates a new annotation with the given tree, span, type, annotator and confidence. |
|
Annotation(AnnotationTree tree,
Span span,
java.lang.String type,
java.lang.String annotator,
double confidence,
java.lang.String comment)
Creates a new annotation with the given tree, span, type, annotator, confidence and comment. |
Method Summary | |
void |
add(Annotation a)
Add the specified annotation to this annotation or one of its children. |
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
void |
addFeatureValue(java.lang.String p,
java.lang.String v,
java.lang.String delim)
Adds a value to this annotation's feature set. |
void |
addType(java.lang.String t)
|
static Annotation |
adjustedAnnotation(AnnotationTree tree,
Annotation a,
int adjustment)
Copies the specified annotation and adjusts its span by the specified adjustment creating a new annotation with identical properties using the specified tree. |
boolean |
allowsChildren()
|
int |
binarySearch(Annotation a)
|
java.util.Enumeration |
children()
|
void |
clear()
|
int |
compareTo(java.lang.Object o)
|
int |
compareToNoFile(java.lang.Object o)
|
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
get(int i)
|
Annotation[] |
getAllContainedNodesOfType(java.lang.String type)
Returns an array of all annotations which are children of this and are of the specified type. |
Annotation[] |
getAllContainedNodesOfTypes(java.util.Set types)
Returns an array of all the annotations which are children of this and are of any of the specified types. |
boolean |
getAllowsChildren()
|
Annotation |
getAncestorOfType(java.lang.String type)
Returns the first ancestor of this which is of the specified type. |
AnnotationFile |
getAnnotationFile()
|
AnnotationTree |
getAnnotationTree()
|
java.lang.String |
getAnnotator()
|
javax.swing.tree.TreeNode |
getChildAt(int i)
|
int |
getChildCount()
|
java.util.List |
getChildren()
Returns a list containing the children nodes of this. |
java.lang.String |
getComment()
|
double |
getConfidence()
|
Annotation[] |
getContainedNodesOfType(java.lang.String type)
Returns an array of the top-most annotations which are children of this and any of the specified types. |
Annotation[] |
getContainedNodesOfTypes(java.util.Set types)
Returns an array of the top-most annotations which are children of this and are of any of the specified types. |
int |
getDepth()
|
Annotation |
getEndAnnotation()
|
java.lang.String |
getFeature(java.lang.String p)
|
java.lang.String |
getFeatures()
|
AnnotationFile |
getFile()
|
Annotation |
getFirstLeaf()
|
java.lang.String |
getId()
|
int |
getIndex(javax.swing.tree.TreeNode n)
|
java.util.Set |
getLabel()
|
Annotation |
getLastLeaf()
|
java.util.List |
getLeaves()
|
Annotation |
getNextDepthFirst()
|
Annotation |
getNextLeaf()
|
javax.swing.tree.TreeNode |
getParent()
|
javax.swing.tree.TreeNode[] |
getPath()
|
java.util.List |
getPathTo(java.lang.Object o)
|
Annotation |
getPreviousDepthFirst()
|
Annotation |
getPreviousLeaf()
|
boolean |
getSave()
|
java.lang.String |
getSingleType()
|
Span |
getSpan()
Returns the span for this annotation. |
Annotation |
getStartAnnotation()
|
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor)
|
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
|
java.util.Set |
getType()
|
boolean |
gt(java.lang.Object o)
Determines whether this is greater than o . |
boolean |
hasChildren()
|
boolean |
hasPathTo(java.lang.Object o)
|
boolean |
hasProperty(java.lang.String p)
|
int |
indexOf(java.lang.Object o)
|
void |
insert(javax.swing.tree.MutableTreeNode n,
int i)
|
boolean |
intersects(java.lang.Object o)
Determines whether this intersects o . |
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
|
boolean |
isDescendantOf(Annotation a)
|
boolean |
isEmpty()
|
boolean |
isLeaf()
|
java.util.Iterator |
iterator()
Returns an iterator for the children of this annotation. |
int |
lastIndexOf(java.lang.Object o)
|
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int i)
|
boolean |
lt(java.lang.Object o)
Determines whether this is less than o . |
boolean |
readBytes(java.io.DataInputStream s)
|
void |
remove(Annotation a)
Removes the annotation a from this causing it to shrink. |
void |
remove(Annotation a,
boolean shrink)
Removes the annotaiton a from this causing it to shrink if shrink is true. |
void |
remove(int i)
Removes the ith child from this causing this to shrink. |
void |
remove(javax.swing.tree.MutableTreeNode n)
|
boolean |
remove(java.lang.Object o)
Removes o from this if it is an Annotation causing this to shrink. |
boolean |
removeAll(java.util.Collection c)
|
Annotation |
removeEndAnnotation()
|
void |
removeFeature(java.lang.String p)
|
void |
removeFeatureValue(java.lang.String p,
java.lang.String v,
java.lang.String delim)
Removes a feature value from this annotation's feature set. |
void |
removeFromParent()
|
Annotation |
removeStartAnnotation()
|
void |
removeType(java.lang.String t)
|
void |
setAnnotations(Annotation[] anns)
|
void |
setAnnotations(java.util.List anns)
|
void |
setAnnotator(java.lang.String a)
|
void |
setComment(java.lang.String c)
|
void |
setConfidence(double c)
|
void |
setFeature(java.lang.String p,
java.lang.String v)
|
void |
setId(java.lang.String id)
|
void |
setParent(javax.swing.tree.MutableTreeNode p)
|
void |
setSave(boolean save)
Used to specify whether this annotation should be saved. |
void |
setSpan(Span s)
|
void |
setSpan(Span s,
boolean update)
|
void |
setType(java.util.Set t)
|
void |
setType(java.lang.String t)
|
void |
setUserObject(java.lang.Object o)
|
int |
size()
|
java.util.List |
subList(int s,
int e)
|
boolean |
subsumes(java.lang.Object o)
Determines whether this subsumes o . |
java.lang.Object[] |
toArray()
|
void |
toArray(Annotation[] a)
|
java.lang.Object[] |
toArray(java.lang.Object[] o)
|
java.lang.String |
toString()
|
java.lang.String |
toText()
|
boolean |
writeBytes(java.io.DataOutputStream s)
|
Methods inherited from class org.annotation.util.FeatureMap |
addFeatureValue, existsFeature, getFeatureAsSet, getFeatureAsSet, getFeatureSet, removeFeatureValue, setFeatures, setProperties |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final org.annotation.wordfreak.NoFileComparator NOFILECOMPARATOR
public static final org.annotation.wordfreak.SpanComparator SPANCOMPARATOR
public static final org.annotation.wordfreak.OffsetComparator OFFSETCOMPARATOR
public static final java.lang.String ORDER
public static final Annotation[] EMPTY_ARRAY
public static final java.lang.String EMPTY_SPAN_STRING
public static final java.lang.String TYPE
public static final java.lang.String ID
public static final java.lang.String LABEL
public static final java.lang.String SPAN
public static final java.lang.String CONFIDENCE
public static final java.lang.String ANNOTATOR
public static final java.lang.String COMMENT
Constructor Detail |
public Annotation(AnnotationTree tree, Span span)
tree
- The annotation tree for this annotation.span
- The span of this annotation.public Annotation(AnnotationTree tree, Span span, Annotation[] children)
tree
- The tree for the new annotation.span
- The span for this annotation.children
- The children of the new annotation.public Annotation(AnnotationTree t, Annotation a)
t
- The tree for the new annotation.a
- The annotaion to be copied.public Annotation(AnnotationTree tree, Span span, java.lang.String type, java.lang.String annotator, double confidence)
tree
- The tree for the new annotation.span
- The span for the new annotation.type
- The type of the new annotation.annotator
- The annotator's name for the new annotation.confidence
- The annotator's confidence in this annotation.public Annotation(AnnotationTree tree, Span span, java.lang.String type, java.lang.String annotator, double confidence, java.lang.String comment)
tree
- The tree for the new annotation.span
- The span of the new annotation.type
- The type of the new annotation.annotator
- The annotator's name for the new annotation.confidence
- The annotator's confidence in this annotation.comment
- A comment about this annotation.public Annotation(AnnotationTree tree, Span s, java.util.List children)
tree
- The tree which contains the new annotation.children
- The children of the annotation.public Annotation(AnnotationTree tree, Span span, java.util.List children, java.lang.String type, java.lang.String annotator, double confidence)
tree
- The tree which contains the new annotation.children
- The children of the annotation.type
- The type of the new annotation.annotator
- The annotator name for this annotation.confidence
- The annotator confidence in this annotation.Method Detail |
public static Annotation adjustedAnnotation(AnnotationTree tree, Annotation a, int adjustment)
tree
- The tree for the new annotation.a
- The annotaion to be copied.adjustment
- The value added to the start and end of the specified annotation's span to create the adjusted annotation.
public javax.swing.tree.TreeNode getChildAt(int i)
getChildAt
in interface javax.swing.tree.TreeNode
public java.lang.Object get(int i)
public int getIndex(javax.swing.tree.TreeNode n)
getIndex
in interface javax.swing.tree.TreeNode
public int indexOf(java.lang.Object o)
indexOf
in interface Recursable
public int lastIndexOf(java.lang.Object o)
public java.util.ListIterator listIterator()
public java.util.ListIterator listIterator(int i)
public java.util.List subList(int s, int e)
public java.lang.Object[] toArray(java.lang.Object[] o)
public Annotation getStartAnnotation()
public Annotation getEndAnnotation()
public Annotation getFirstLeaf()
public Annotation getNextLeaf()
public Annotation getPreviousLeaf()
public Annotation getLastLeaf()
public Annotation getNextDepthFirst()
public Annotation getPreviousDepthFirst()
public void setParent(javax.swing.tree.MutableTreeNode p)
setParent
in interface javax.swing.tree.MutableTreeNode
public javax.swing.tree.TreeNode getParent()
getParent
in interface javax.swing.tree.TreeNode
public void insert(javax.swing.tree.MutableTreeNode n, int i)
insert
in interface javax.swing.tree.MutableTreeNode
public boolean add(java.lang.Object o)
public void add(Annotation a)
a
- The annotation to be added to this annotation.public boolean addAll(java.util.Collection c)
public boolean removeAll(java.util.Collection c)
public int binarySearch(Annotation a)
public void removeFromParent()
removeFromParent
in interface javax.swing.tree.MutableTreeNode
public void remove(javax.swing.tree.MutableTreeNode n)
remove
in interface javax.swing.tree.MutableTreeNode
public void remove(int i)
remove
in interface javax.swing.tree.MutableTreeNode
public boolean remove(java.lang.Object o)
o
from this if it is an Annotation
causing this to shrink.
If o
is not Annotaiton
an exception is thrown.
public void remove(Annotation a)
a
from this causing it to shrink.
public void remove(Annotation a, boolean shrink)
a
from this causing it to shrink if shrink
is true.
public void clear()
public Annotation removeStartAnnotation()
public Annotation removeEndAnnotation()
public int getChildCount()
getChildCount
in interface javax.swing.tree.TreeNode
public boolean getAllowsChildren()
getAllowsChildren
in interface javax.swing.tree.TreeNode
public boolean isLeaf()
isLeaf
in interface javax.swing.tree.TreeNode
public int size()
size
in interface Recursable
public java.util.Iterator iterator()
iterator
in interface Recursable
public boolean hasChildren()
public boolean allowsChildren()
public void setAnnotations(java.util.List anns)
public void setAnnotations(Annotation[] anns)
public int getDepth()
public boolean getSave()
public void setSave(boolean save)
save
- Specify true to same this annotation, false otherwise.public java.lang.String getId()
public void setId(java.lang.String id)
public java.lang.String getFeature(java.lang.String p)
getFeature
in class FeatureMap
public void setFeature(java.lang.String p, java.lang.String v)
setFeature
in class FeatureMap
public void removeFeature(java.lang.String p)
removeFeature
in class FeatureMap
public void addFeatureValue(java.lang.String p, java.lang.String v, java.lang.String delim)
FeatureMap
addFeatureValue
in class FeatureMap
p
- the name of the feature.v
- the value to be added to the set.delim
- the delimitor used to seperate the values.public void removeFeatureValue(java.lang.String p, java.lang.String v, java.lang.String delim)
FeatureMap
removeFeatureValue
in class FeatureMap
p
- the name of the feature.v
- the value to be removed from the set.delim
- the delimitor which seperates the values.public java.lang.String getFeatures()
public Span getSpan()
public void setSpan(Span s)
public void setSpan(Span s, boolean update)
public AnnotationTree getAnnotationTree()
public AnnotationFile getAnnotationFile()
public AnnotationFile getFile()
public java.util.Set getLabel()
public java.util.Set getType()
public java.lang.String getSingleType()
public void addType(java.lang.String t)
public void removeType(java.lang.String t)
public void setType(java.lang.String t)
public void setType(java.util.Set t)
public java.lang.String getAnnotator()
public void setAnnotator(java.lang.String a)
public double getConfidence()
public void setConfidence(double c)
public java.lang.String getComment()
public void setComment(java.lang.String c)
public void setUserObject(java.lang.Object o)
setUserObject
in interface javax.swing.tree.MutableTreeNode
public java.lang.String toString()
public boolean writeBytes(java.io.DataOutputStream s)
public boolean readBytes(java.io.DataInputStream s)
public java.lang.String toText()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public int compareToNoFile(java.lang.Object o)
public boolean hasProperty(java.lang.String p)
hasProperty
in interface Property
public boolean containsAll(java.util.Collection c)
public boolean subsumes(java.lang.Object o)
TreeComparable
o
. If this equals
o
then this subsumes o.
subsumes
in interface TreeComparable
public boolean contains(java.lang.Object o)
contains
in interface Recursable
public javax.swing.tree.TreeNode[] getPath()
public java.util.List getPathTo(java.lang.Object o)
getPathTo
in interface Recursable
public boolean hasPathTo(java.lang.Object o)
hasPathTo
in interface Recursable
public boolean isDescendantOf(Annotation a)
public boolean intersects(java.lang.Object o)
TreeComparable
o
.
intersects
in interface Recursable
public boolean lt(java.lang.Object o)
TreeComparable
o
.
lt
in interface Recursable
public boolean gt(java.lang.Object o)
TreeComparable
o
.
gt
in interface Recursable
public boolean equals(java.lang.Object o)
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
getTransferData
in interface java.awt.datatransfer.Transferable
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
public boolean isEmpty()
public java.lang.Object[] toArray()
public void toArray(Annotation[] a)
public java.util.List getLeaves()
public java.util.Enumeration children()
children
in interface javax.swing.tree.TreeNode
public java.util.List getChildren()
public Annotation getAncestorOfType(java.lang.String type)
type
- The type of the ancestor.
public Annotation[] getAllContainedNodesOfType(java.lang.String type)
type
- The type of the children.
public Annotation[] getContainedNodesOfType(java.lang.String type)
type
- The types of the children.
public Annotation[] getContainedNodesOfTypes(java.util.Set types)
types
- The potential types of the children.
public Annotation[] getAllContainedNodesOfTypes(java.util.Set types)
types
- The potential types of the children.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |