GXPARSE hosted by SourceForge.net Logo

ca.gorman.io
Class Resequencer.MarkGroup<K>

java.lang.Object
  extended by ca.gorman.io.Resequencer.MarkGroup<K>
All Implemented Interfaces:
Closeable
Enclosing interface:
Resequencer<K>

public abstract static class Resequencer.MarkGroup<K>
extends Object
implements Closeable

Manager (access and temporary storage) for Marks with keys of type K . Each Resequencer.Buffer instance has a MarkGroup that can either be exclusively owned, or shared with other Buffer instances.


Constructor Summary
protected Resequencer.MarkGroup(List<Resequencer.Mark<K>> markList, Map<K,Resequencer.Mark<K>> markMap)
           Construct MarkGroup<K> with specified List and Map.
 
Method Summary
 void close()
           Close the MarkGroup and all of the Mark objects in the MarkGroup.
protected  List<Resequencer.Mark<K>> getList()
           Get the internal List used to find a Mark by its index.
protected  Map<K,Resequencer.Mark<K>> getMap()
           Get the internal Map used to find a Mark by its key.
protected  Resequencer.Mark<K> getMark(int index)
           Get an existing Mark.
 Resequencer.Mark<K> getMark(K key)
           Get an existing Mark.
 Iterator<Resequencer.Mark<K>> iterator()
           Get a Mark Iterator that does not support remove().
 Resequencer.Mark<K> mark()
           create a Mark with no key.
 Resequencer.Mark<K> mark(K key)
           Get the Mark for a particular key, creating a Mark if one does not exist.
static
<K> Resequencer.MarkGroup<K>
newInstance()
           Create a new MarkGroup<K>.
protected  Resequencer.Mark<K> newMark()
           Create a new Mark with no key in this MarkGroup.
protected  Resequencer.Mark<K> newMark(K key)
           Create a new Mark for a specified key in this MarkGroup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resequencer.MarkGroup

protected Resequencer.MarkGroup(List<Resequencer.Mark<K>> markList,
                                Map<K,Resequencer.Mark<K>> markMap)

Construct MarkGroup<K> with specified List and Map.

Method Detail

newInstance

public static <K> Resequencer.MarkGroup<K> newInstance()

Create a new MarkGroup<K>.


close

public void close()

Close the MarkGroup and all of the Mark objects in the MarkGroup.

Specified by:
close in interface Closeable

newMark

protected Resequencer.Mark<K> newMark(K key)

Create a new Mark for a specified key in this MarkGroup.


newMark

protected Resequencer.Mark<K> newMark()

Create a new Mark with no key in this MarkGroup.


iterator

public Iterator<Resequencer.Mark<K>> iterator()

Get a Mark Iterator that does not support remove(). The Iterator returns all Marks,including those that have no key.

The Iterator does not support Iterator.remove() remove because a Mark cannot be removed after it has been created.


mark

public Resequencer.Mark<K> mark(K key)

Get the Mark for a particular key, creating a Mark if one does not exist.

Parameters:
key - Identifies the mark to be retreived or created
Throws:
NullPointerException - if key is null

mark

public Resequencer.Mark<K> mark()

create a Mark with no key.


getMark

public Resequencer.Mark<K> getMark(K key)

Get an existing Mark.

Throws:
NoSuchElementException - if the Mark does not exist.

getMark

protected Resequencer.Mark<K> getMark(int index)

Get an existing Mark.

Throws:
IndexOutOfBoundsException - if a Mark does not exist for that index or if index < 0

getList

protected List<Resequencer.Mark<K>> getList()

Get the internal List used to find a Mark by its index. All other methods in this MarkGroup use this method to access the List.

Returns:
A List that is not null

getMap

protected Map<K,Resequencer.Mark<K>> getMap()

Get the internal Map used to find a Mark by its key. All other methods in this MarkGroup use this method to access the Map.

Returns:
A Map that is not null

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License