org.nodal.util
Class SequenceFilter

java.lang.Object
  extended byorg.nodal.util.NodeFilter
      extended byorg.nodal.util.SequenceFilter
All Implemented Interfaces:
Content, Node, NodeContent, SequenceContent, SequenceNode, TxnMonitorable

public abstract class SequenceFilter
extends NodeFilter
implements SequenceNode

Combine Node and SequenceContent interfaces to create the Sequence interface.

This class takes a Node interface and a SequenceContent interface and aggregates their interfaces to create the Sequence interface. It can be used all by itself or inherited so as to provide a filter upon which particular methods can be selectively overridden.

Author:
Lee Iverson

Nested Class Summary
 
Nested classes inherited from class org.nodal.model.SequenceNode
SequenceNode.Editor
 
Field Summary
protected  SequenceContent seq
           
 
Fields inherited from class org.nodal.util.NodeFilter
node
 
Constructor Summary
protected SequenceFilter(Node n, SequenceContent r)
           
 
Method Summary
 MapNode asMapNode()
          The Node's contents expressed as a Map.
 RecordNode asRecordNode()
          The Node's contents expressed as a Record.
 SequenceNode asSequenceNode()
          The Node's contents expressed as a Sequence.
 NodeContent content()
          The Node's contents.
abstract  NodeContent.Editor edit()
          An Editor for changing the Content of this Node.
 Getter item(int index)
          Return a Getter for the item at the given index.
 java.util.Iterator properties()
          A sequence of all of the properties currently indexing the contents if this Content.
 Getter range(int start, int end)
          Return a Getter for the sequence of items indexed from start to end, inclusive.
 int size()
          The number of properties contained in this Content object.
 Getter value(java.lang.Object obj)
          A generic Getter for property values, given a property.
 
Methods inherited from class org.nodal.util.NodeFilter
asAnchor, bareNode, capability, editMap, editRecord, editSequence, history, id, path, repository, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nodal.model.SequenceNode
editSequence
 
Methods inherited from interface org.nodal.model.SequenceContent
asSeq, getItem, indexIsValid
 
Methods inherited from interface org.nodal.model.Content
getValue, invert, isValidProperty, type
 
Methods inherited from interface org.nodal.model.Node
asAnchor, bareNode, capability, editMap, editRecord, history, id, path, repository, type
 
Methods inherited from interface org.nodal.model.TxnMonitorable
addTxnHandler, removeTxnHandler
 

Field Detail

seq

protected SequenceContent seq
Constructor Detail

SequenceFilter

protected SequenceFilter(Node n,
                         SequenceContent r)
Method Detail

content

public NodeContent content()
Description copied from interface: Node
The Node's contents.

If the Capability does not provide read access, then this will return null.

Specified by:
content in interface Node
Overrides:
content in class NodeFilter

size

public int size()
Description copied from interface: Content
The number of properties contained in this Content object.

Specified by:
size in interface Content

properties

public java.util.Iterator properties()
Description copied from interface: Content
A sequence of all of the properties currently indexing the contents if this Content.

Specified by:
properties in interface Content

value

public Getter value(java.lang.Object obj)
             throws PropertyConstraintFailure
Description copied from interface: Content
A generic Getter for property values, given a property.

Will throw an exception if the property type is invalid, but not if the property is not available in this Node's content. This way, a value Getter can be established in anticipation of the addition of a property.

Specified by:
value in interface Content
Parameters:
obj - the Object that identifies this property
Throws:
PropertyConstraintFailure

asMapNode

public MapNode asMapNode()
Description copied from interface: Node
The Node's contents expressed as a Map. This is a shortcut for content().asMap().

Specified by:
asMapNode in interface Node
Overrides:
asMapNode in class NodeFilter

asRecordNode

public RecordNode asRecordNode()
Description copied from interface: Node
The Node's contents expressed as a Record. This is a shortcut for content().asRecord().

Specified by:
asRecordNode in interface Node
Overrides:
asRecordNode in class NodeFilter

asSequenceNode

public SequenceNode asSequenceNode()
Description copied from interface: Node
The Node's contents expressed as a Sequence. This is a shortcut for content().asSequence().

Specified by:
asSequenceNode in interface Node
Overrides:
asSequenceNode in class NodeFilter

item

public Getter item(int index)
            throws IndexBoundsException
Description copied from interface: SequenceContent
Return a Getter for the item at the given index.

Specified by:
item in interface SequenceContent
Throws:
IndexBoundsException

range

public Getter range(int start,
                    int end)
             throws IndexBoundsException
Description copied from interface: SequenceContent
Return a Getter for the sequence of items indexed from start to end, inclusive.

The value returned by the Getter is an instance of org.nodal.util.Seq.

Specified by:
range in interface SequenceContent
Throws:
IndexBoundsException
See Also:
Seq

edit

public abstract NodeContent.Editor edit()
Description copied from interface: Node
An Editor for changing the Content of this Node. If the Capability does not provide write access, then this will return null.

Specified by:
edit in interface Node
Overrides:
edit in class NodeFilter