org.annotation.wordfreak
Class AnnotationSelection

java.lang.Object
  extended byorg.annotation.wordfreak.AnnotationSelection

public class AnnotationSelection
extends java.lang.Object

This class represents the current selection and allows for multiple regions to be selected simultaniously.


Constructor Summary
AnnotationSelection()
          Creates a new annotation selection with no selected regions.
AnnotationSelection(java.util.List region)
          Creates a new annotation selection with the specified region.
 
Method Summary
 void addAll(AnnotationSelection annotationSelection)
          Adds each region in the specified annotation selection to this selection.
 int addRegionToSelection(java.util.List region)
          Adds the specfied region to this selection.
 void addToRegion(java.lang.Object regionObject)
          Adds the specified object ot the current region or creates a region if no region exisits.
 void clear()
          Removes all regions from this selection.
 java.lang.Object get(int index)
          Returns the region object in the selection specified by the given index.
 java.util.List getCurrentRegion()
          Returns the current region.
 int getCurrentRegionIndex()
          Returns the index of the current region.
 java.util.List getFirstRegion()
          Returns the left most region
 java.util.List getLastRegion()
          Returns the left most region
 int getNumberOfRegions()
          Returns the number of regions in this selection.
 java.util.List getRegion(int n)
          Returns the region specified by the given index.
 int newRegion(java.lang.Object regionObject)
          Creates a new region using the specified object and adds it to this selection.
 void removeRegion(int regionIndex)
          Removed the region specified by the give index.
 int size()
          Returns the number of region objects in the entire selection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationSelection

public AnnotationSelection()
Creates a new annotation selection with no selected regions.


AnnotationSelection

public AnnotationSelection(java.util.List region)
Creates a new annotation selection with the specified region.

Parameters:
region - The initial region in the selection.
Method Detail

newRegion

public int newRegion(java.lang.Object regionObject)
Creates a new region using the specified object and adds it to this selection.

Parameters:
regionObject - An object to be placed in the new region.
Returns:
The index of the newly created region.

addToRegion

public void addToRegion(java.lang.Object regionObject)
Adds the specified object ot the current region or creates a region if no region exisits.

Parameters:
regionObject - An object to be added to the current region.

addRegionToSelection

public int addRegionToSelection(java.util.List region)
Adds the specfied region to this selection.

Parameters:
region - The region to be added to this selection.
Returns:
The index of the region being added.

removeRegion

public void removeRegion(int regionIndex)
Removed the region specified by the give index.

Parameters:
regionIndex - The index of the region to be removed.

getNumberOfRegions

public int getNumberOfRegions()
Returns the number of regions in this selection.

Returns:
The number of regions in this selection.

getCurrentRegion

public java.util.List getCurrentRegion()
Returns the current region.

Returns:
The list representing the current region.

getCurrentRegionIndex

public int getCurrentRegionIndex()
Returns the index of the current region.

Returns:
The index of the current region or -1 if no regions exist.

getRegion

public java.util.List getRegion(int n)
Returns the region specified by the given index.

Parameters:
n - The region index to be returned.
Returns:
The region specified by the given index.

getFirstRegion

public java.util.List getFirstRegion()
Returns the left most region

Returns:
The left most region

getLastRegion

public java.util.List getLastRegion()
Returns the left most region

Returns:
The left most region

addAll

public void addAll(AnnotationSelection annotationSelection)
Adds each region in the specified annotation selection to this selection.

Parameters:
annotationSelection - The annotation selection to add this this selction.

clear

public void clear()
Removes all regions from this selection.


size

public int size()
Returns the number of region objects in the entire selection.

Returns:
the number of region objects in the entire selection.

get

public java.lang.Object get(int index)
Returns the region object in the selection specified by the given index. This assumes a total ordering of all region objects which is independent of region so that any object in the selection can be accessed via a unique index.

Parameters:
index - The index of the region object to be returned.
Returns:
the region object in the selection specified by the given index.

toString

public java.lang.String toString()


Copyright © 2004 Thomas Morton and Jeremy LaCivita. All Rights Reserved.