BeanIO 1.2.3

org.beanio.parser
Class Node

java.lang.Object
  extended by org.beanio.parser.Node
Direct Known Subclasses:
GroupNode, RecordNode

public abstract class Node
extends Object

A Node is the dynamic counterpart to the NodeDefinition and holds the current state of a node while reading or writing the stream.

Since:
1.0
Author:
Kevin Seim

Field Summary
protected  int groupCount
           
 
Constructor Summary
Node()
          Constructs a new Node.
 
Method Summary
abstract  Node close()
          Checks for missing records.
abstract  List<Node> getChildren()
          Returns a list of child nodes.
 int getGroupCount()
          Returns the number of times this node has repeated within its parent.
 int getMaxOccurs()
          Returns the maximum number of time this node must appear within the context of its parent, or -1 for unbounded.
 int getMinOccurs()
          Returns the minimum number of times this node must appear within the context of its parent.
 String getName()
          Returns the name of this node.
protected abstract  NodeDefinition getNodeDefinition()
          Returns this nodes's definition.
 int getOrder()
          Returns the order in which this node must appear within the context of its parent.
 boolean isMaxOccursReached()
          Tests if the max occurs has been reached for this node.
 boolean isRecord()
          Returns true if this node is a leaf node / record.
abstract  Node matchAny(Record record)
          Finds the child node that matches a record, ignoring the current state of each node.
abstract  Node matchNext(Record record)
          Finds the child node that matches a record, based on the current state of each node.
 void reset()
          Called by its parent to reset node statistics.
 void setGroupCount(int groupCount)
          Sets the number of times this node has repeated within its parent.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

groupCount

protected int groupCount
Constructor Detail

Node

public Node()
Constructs a new Node.

Method Detail

getChildren

public abstract List<Node> getChildren()
Returns a list of child nodes.

Returns:
the list of child nodes

isMaxOccursReached

public boolean isMaxOccursReached()
Tests if the max occurs has been reached for this node.

Returns:
true if max occurs has been reached

matchNext

public abstract Node matchNext(Record record)
Finds the child node that matches a record, based on the current state of each node.

Parameters:
record - the record to match
Returns:
the matched node, or null if no match was found

matchAny

public abstract Node matchAny(Record record)
Finds the child node that matches a record, ignoring the current state of each node.

Parameters:
record - the record to match
Returns:
the matching leaf node, or null if the record could not be matched

close

public abstract Node close()
Checks for missing records. This method is called when the end of the stream has been reached.


reset

public void reset()
Called by its parent to reset node statistics.


isRecord

public boolean isRecord()
Returns true if this node is a leaf node / record.

Returns:
true if this node is a record

getNodeDefinition

protected abstract NodeDefinition getNodeDefinition()
Returns this nodes's definition.

Returns:
the node definition

getMinOccurs

public int getMinOccurs()
Returns the minimum number of times this node must appear within the context of its parent.

Returns:
the minimum number of occurrences

getMaxOccurs

public int getMaxOccurs()
Returns the maximum number of time this node must appear within the context of its parent, or -1 for unbounded.

Returns:
the maximum number of occurrences

getOrder

public int getOrder()
Returns the order in which this node must appear within the context of its parent. Multiple nodes may have the same order if they can appear in any order.

Returns:
the node order

getName

public String getName()
Returns the name of this node.

Returns:
the node name

getGroupCount

public int getGroupCount()
Returns the number of times this node has repeated within its parent.

Returns:
the number of times this node has repeated

setGroupCount

public void setGroupCount(int groupCount)
Sets the number of times this node has repeated within its parent.

Parameters:
groupCount - the new number of times this node has repeated

toString

public String toString()
Overrides:
toString in class Object

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim