Package org.opensextant.annotations
Class Annotation
java.lang.Object
org.opensextant.annotations.DeepEyeData
org.opensextant.annotations.Annotation
An annotation is at least a typed name/value pair created by something.
Creator is called "contributor" because lots of parties can contribute annotations to this pool.
Every annotation belongs to some record (ident by rec_id)
Every annotation instance has an ID itself.
Offset and attributes are optional, as some annotations apply to entire records, rather than data at a certain offset.
- Author:
- ubaldino
-
Field Summary
FieldsModifier and TypeFieldDescriptionlongoptional offsetstatic StringSource ID here is very much optional Currently it is useful for SQLite usage.Fields inherited from class org.opensextant.annotations.DeepEyeData
attrs, id, value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOffset(int x) voidadd annot.offset = x or annot.attrs.offsets = "x1;x2;x3"...protected voidaddOffsetTo(Map<String, Object> repr) Add offset information (offset, len, offsets, etc ) into the representation of this annotation.longCompute span end offset.intCompute length, as logic is related to defaults, if value is set or not.getMap()Generate a key-value representation of the object with its current values.booleanvoidThis is provided mainly for testing.voidsetLength(int l) toString()Methods inherited from class org.opensextant.annotations.DeepEyeData
addAttribute, asMap, getAttributeNames, getAttributes, isValue, isValue, list, list, map, newAttributes
-
Field Details
-
rec_id
-
name
-
source_id
Source ID here is very much optional Currently it is useful for SQLite usage. -
offset
public long offsetoptional offset -
contrib
-
OFFSETS_FLD
-
-
Constructor Details
-
Annotation
public Annotation() -
Annotation
-
Annotation
-
Annotation
-
-
Method Details
-
getAttribute
-
toString
-
setLength
public void setLength(int l) -
hasLength
public boolean hasLength() -
getLength
public int getLength()Compute length, as logic is related to defaults, if value is set or not. etc.- Returns:
-
getEndOffset
public long getEndOffset()Compute span end offset.- Returns:
- end offset (long)
-
addOffsetTo
Add offset information (offset, len, offsets, etc ) into the representation of this annotation. Some annotations may have a more complex view of offset, e.g., EntityAnnotation overrides this. -
addOffset
public void addOffset(int x) -
getOffsets
-
addOffsetAttribute
public void addOffsetAttribute()add annot.offset = x or annot.attrs.offsets = "x1;x2;x3"... a string list, not a JSON obj. -
resetOffsets
public void resetOffsets()This is provided mainly for testing. The EntityAnnotation class is not intended for reuse e.g., populate an instance and then reset offsets alone. Use sparingly. -
getMap
Generate a key-value representation of the object with its current values.- Specified by:
getMapin classDeepEyeData- Returns:
- Map
-