org.umber.catalan.process.queue
Class DefaultNamedQueue

java.lang.Object
  extended byorg.umber.catalan.process.queue.DefaultNamedQueue
All Implemented Interfaces:
INamedQueue, IPropertyHolder, IQueue

public class DefaultNamedQueue
extends java.lang.Object
implements INamedQueue

A IQueue that holds named properties; an INamedQueue should wrap a Map collection. The getNodes() method returns the set of values in the Map, without any key info.

Author:
jsheets

Constructor Summary
DefaultNamedQueue()
          Creates a new empty instance of DefaultNamedQueue.
DefaultNamedQueue(java.util.Map nodes, java.util.Map properties, boolean writable)
          Creates a new instance of DefaultNamedQueue initialized with the given parameters.
 
Method Summary
 java.util.Map getMap()
          Retrieves the key/value Map of all named nodes in the INamedQueue.
 java.util.List getNodes()
          Retrieves the current node processing list.
 IWorkProperties getProperties()
          Retrieves the container for all properties currently set in the workspace.
 boolean isReadOnly()
          Determines if a queue is read-only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNamedQueue

public DefaultNamedQueue()
Creates a new empty instance of DefaultNamedQueue.


DefaultNamedQueue

public DefaultNamedQueue(java.util.Map nodes,
                         java.util.Map properties,
                         boolean writable)
                  throws QueueException
Creates a new instance of DefaultNamedQueue initialized with the given parameters.

Parameters:
nodes - default Map of named nodes, can be null
properties - Map of IQueue-level properties, can be null
writable - true to allow modification of the queue nodes
Throws:
QueueException - if properties map contains any non-String keys
Method Detail

getProperties

public IWorkProperties getProperties()
Retrieves the container for all properties currently set in the workspace.

Specified by:
getProperties in interface IPropertyHolder
Returns:
all workspace properties

getNodes

public java.util.List getNodes()
Retrieves the current node processing list. This node list is not modifiable; all node manipulation must go through getMap().

Specified by:
getNodes in interface IQueue
Returns:
the current node list

isReadOnly

public boolean isReadOnly()
Determines if a queue is read-only. The nodes of a read-only queue can be examined, but not moved around. Any attempts to add or remove nodes will trigger an UnsupportedOperationException.

Note: Operations on the nodes themselves cannot be screened out, so a read-only queue is only truly read-only if all of its nodes are immutable.

Specified by:
isReadOnly in interface IQueue
Returns:
true if queue is read-only

getMap

public java.util.Map getMap()
Retrieves the key/value Map of all named nodes in the INamedQueue. Any nodes which have been added to the List returned by getNodes() are not named nodes and will not appear in this map.

Specified by:
getMap in interface INamedQueue
Returns:
Map of all named IQueue elements