## gate.util
Class SimpleSortedSet

    java.lang.Object
      |
      +--gate.util.SimpleSortedSet

public class SimpleSortedSet
extends Object

The purpose of this Map is to combine the functionality found in TreeSet, especially first() and tailSet() with the hashcode driven map using native long as key to hold the annotations orederd by their offset. It is used in the SinglePhaseTransducer.transduce()

Field Summary
`(package private) static int` `INCREMENT` the initial dimension of the offsets array
`(package private) HashMapLong` `m` the Map contianing Lists with the annotations by offset as key
`(package private) int` `size` size of the offset's array
`(package private) long[]` `theArray` the array containing the distinct offsets in the map It should be sorted before usinf the first and tailSet methods
`(package private) int` `tsindex` tailSet generated index - this is the index found to be les or equl to the argument provided when tailSet() methos was invoked

Constructor Summary
`SimpleSortedSet()` the Contructor.

Method Summary
`boolean` `add(long elValue, Object o)` add the new annotation to the annotation list for the given offset Note: if the offset is not in the map new empty list is created and the annotation is added to it
`long` `first()` retrive the smallest offset of the array.
`Object` `get(long elValue)` the get method retrive the List element by offset key given as argument
`boolean` `isEmpty()` is the map is empty
`int` `size()`
`void` `sort()` sort the offset's array in ascending way
`SimpleSortedSet` `tailSet(long elValue)` calculate the index of the first element in the offset's array that is equal or not greater then the given one

Methods inherited from class java.lang.Object
`<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### m

    HashMapLong m

  the Map contianing Lists with the annotations by offset as key

### INCREMENT

    static final int INCREMENT

  the initial dimension of the offsets array

### theArray

    long[] theArray

  the array containing the distinct offsets in the map It should be sorted before usinf the first and tailSet methods

### tsindex

    int tsindex

  tailSet generated index - this is the index found to be les or equl to the argument provided when tailSet() methos was invoked

### size

    int size

  size of the offset's array

Constructor Detail

### SimpleSortedSet

    public SimpleSortedSet()

  the Contructor. fills the allocated offset's array with the large possible valuse so any valis value will be placed on front of them.

Method Detail

### get

    public Object get(long elValue)

  the get method retrive the List element by offset key given as argument
  Parameters:
    `the` - offset to which the list should be retrived.

### add

    public boolean add(long elValue,
                       Object o)

  add the new annotation to the annotation list for the given offset Note: if the offset is not in the map new empty list is created and the annotation is added to it
  Parameters:
    `the` - offset of the annotation
    `the` - annotation instance to be placed in the list
  Returns:
    true if the offset is already in the map false otherwise

### sort

    public void sort()

  sort the offset's array in ascending way

### first

    public long first()

  retrive the smallest offset of the array. If there was a tailset before then retrive the smallest or equal element given the index calculated ad tailSet() method
  Returns:
    the offset value conforming the above conditions

### tailSet

    public SimpleSortedSet tailSet(long elValue)

  calculate the index of the first element in the offset's array that is equal or not greater then the given one
  Parameters:
    `the` - value to search for
  Returns:
    actually this. Used to mimic the TreeSet.tailSet()

### isEmpty

    public boolean isEmpty()

  is the map is empty
  Returns:
    true if teher is no element in the map

### size

    public int size()