## gate
Interface AnnotationSet

All Superinterfaces:
  Cloneable, Collection, Serializable, Set

All Known Subinterfaces:
  EventAwareAnnotationSet

All Known Implementing Classes:
  AnnotationSetImpl

public interface AnnotationSet
extends Set, Cloneable, Serializable

Annotation sets

Method Summary
`void` `add(Integer id, Long start, Long end, String type, FeatureMap features)` Create and add an annotation with a pre-existing ID
`Integer` `add(Long start, Long end, String type, FeatureMap features)` Create and add an annotation and return its id
`Integer` `add(Node start, Node end, String type, FeatureMap features)` Create and add an annotation with pre-existing nodes, and return its id
`boolean` `add(Object o)` Add an existing annotation.
`void` `addAnnotationSetListener(AnnotationSetListener l)`
`void` `addGateListener(GateListener l)`
`Node` `firstNode()` Get the node with the smallest offset
`AnnotationSet` `get()` Get all annotations
`Annotation` `get(Integer id)` Find annotations by id
`AnnotationSet` `get(Long offset)` Select annotations by offset.
`AnnotationSet` `get(Long startOffset, Long endOffset)` Select annotations by offset.
`AnnotationSet` `get(Set types)` Select annotations by a set of types.
`AnnotationSet` `get(String type)` Select annotations by type
`AnnotationSet` `get(String type, FeatureMap constraints)` Select annotations by type and features
`AnnotationSet` `get(String type, FeatureMap constraints, Long offset)` Select annotations by type, features and offset
`AnnotationSet` `get(String type, Long startOffset, Long endOffset)` Select annotations by offset and type.
`AnnotationSet` `get(String type, Set featureNames)` Select annotations by type and feature names It returns all annotations of the given type that have the given set of features, regardless of their concrete values If the type == null, then select regardless of type
`Set` `getAllTypes()` Get a set of java.lang.String objects representing all the annotation types present in this annotation set.
`AnnotationSet` `getContained(Long startOffset, Long endOffset)` Select annotations by offset.
`Document` `getDocument()` Get the document this set is attached to.
`String` `getName()` Get the name of this set.
`Iterator` `iterator()` Get an iterator for this set
`Node` `lastNode()` Get the node with the largest offset
`Node` `nextNode(Node node)` Get the first node that is relevant for this annotation set and which has the offset larger than the one of the node provided.
`boolean` `remove(Object o)` Remove an element from this set.
`void` `removeAnnotationSetListener(AnnotationSetListener l)`
`void` `removeGateListener(GateListener l)`
`int` `size()` The size of this set

Methods inherited from interface java.util.Set
`addAll, clear, contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray`

Method Detail

### add

    public Integer add(Node start,
                       Node end,
                       String type,
                       FeatureMap features)

  Create and add an annotation with pre-existing nodes, and return its id

### add

    public void add(Integer id,
                    Long start,
                    Long end,
                    String type,
                    FeatureMap features)
             throws InvalidOffsetException

  Create and add an annotation with a pre-existing ID

### add

    public Integer add(Long start,
                       Long end,
                       String type,
                       FeatureMap features)
                throws InvalidOffsetException

  Create and add an annotation and return its id

### add

    public boolean add(Object o)

  Add an existing annotation. Returns true when the set is modified.
  Specified by:
    `add` in interface `Set`

### iterator

    public Iterator iterator()

  Get an iterator for this set
  Specified by:
    `iterator` in interface `Set`

### size

    public int size()

  The size of this set
  Specified by:
    `size` in interface `Set`

### remove

    public boolean remove(Object o)

  Remove an element from this set.
  Specified by:
    `remove` in interface `Set`

### get

    public Annotation get(Integer id)

  Find annotations by id

### get

    public AnnotationSet get()

  Get all annotations

### get

    public AnnotationSet get(String type)

  Select annotations by type

### get

    public AnnotationSet get(Set types)

  Select annotations by a set of types. Expects a Set of String.

### get

    public AnnotationSet get(String type,
                             FeatureMap constraints)

  Select annotations by type and features

### get

    public AnnotationSet get(String type,
                             Set featureNames)

  Select annotations by type and feature names It returns all annotations of the given type that have the given set of features, regardless of their concrete values If the type == null, then select regardless of type

### get

    public AnnotationSet get(String type,
                             FeatureMap constraints,
                             Long offset)

  Select annotations by type, features and offset

### get

    public AnnotationSet get(Long offset)

  Select annotations by offset. This returns the set of annotations whose start node is the least such that it is greater than or equal to offset. If a positional index doesn't exist it is created.

### get

    public AnnotationSet get(Long startOffset,
                             Long endOffset)

  Select annotations by offset. This returns the set of annotations that overlap totaly or partially the interval defined by the two provided offsets

### get

    public AnnotationSet get(String type,
                             Long startOffset,
                             Long endOffset)

  Select annotations by offset and type. This returns the set of annotations that overlap totaly or partially the interval defined by the two provided offsets and are of the given type

### getContained

    public AnnotationSet getContained(Long startOffset,
                                      Long endOffset)

  Select annotations by offset. This returns the set of annotations that are contained in the interval defined by the two provided offsets. The difference with get(startOffset, endOffset) is that the latter also provides annotations that have a span which covers completely and is bigger than the given one. Here we only get the annotations between the two offsets.

### firstNode

    public Node firstNode()

  Get the node with the smallest offset

### lastNode

    public Node lastNode()

  Get the node with the largest offset

### nextNode

    public Node nextNode(Node node)

  Get the first node that is relevant for this annotation set and which has the offset larger than the one of the node provided.

### getName

    public String getName()

  Get the name of this set.

### getAllTypes

    public Set getAllTypes()

  Get a set of java.lang.String objects representing all the annotation types present in this annotation set.

### getDocument

    public Document getDocument()

  Get the document this set is attached to.

### addAnnotationSetListener

    public void addAnnotationSetListener(AnnotationSetListener l)

### removeAnnotationSetListener

    public void removeAnnotationSetListener(AnnotationSetListener l)

### addGateListener

    public void addGateListener(GateListener l)

### removeGateListener

    public void removeGateListener(GateListener l)