org.extex.typesetter.type.node
Class GenericNodeList

java.lang.Object
  extended by org.extex.typesetter.type.node.AbstractNode
      extended by org.extex.typesetter.type.node.GenericNodeList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Node>, Node, NodeList
Direct Known Subclasses:
HorizontalListNode, VerticalListNode

public class GenericNodeList
extends AbstractNode
implements NodeList

Abstract base class for all NodeLists.

Version:
$Revision: 4739 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.extex.typesetter.type.node.AbstractNode
NO_CHARS
 
Constructor Summary
GenericNodeList()
          Creates a new object.
 
Method Summary
 void add(int index, Node node)
          Add a node to the node list at a given position.
 void add(Node node)
          Add a node to the node list.
 void addSkip(FixedGlue glue)
          Add some glue to the node list.
 void clear()
          Remove all nodes from the list.
protected  java.lang.Object clone()
          
 NodeList copy()
          Clone the current object.
 int countChars()
          This method determines the number of characters contained in a node.
 Node get(int index)
          Getter for a node at a given position.
 CharNode[] getChars()
          Getter for the array of characters enclosed in this node.
 FixedDimen getDepth()
          Getter for the depth of the node.
 FixedDimen getHeight()
          Getter for the height of the node.
 Dimen getMove()
          Getter for the move value of the node list.
 FixedDimen getNaturalDepth()
          Getter for the natural depth.
 FixedDimen getNaturalHeight()
          Getter for the natural height.
 Dimen getShift()
          Getter for the shift value of the node list.
 Dimen getTargetDepth()
          Getter for targetDepth.
 Dimen getTargetHeight()
          Getter for targetHeight.
 Dimen getTargetWidth()
          Getter for targetWidth.
 FixedDimen getWidth()
          Getter for the width of the node.
 boolean isEmpty()
          Test whether the node list is empty.
 java.util.Iterator<Node> iterator()
          Get a new iterator for all nodes in the list.
 Node remove(int index)
          Remove an element at a given position.
 void setDepth(FixedDimen depth)
          Setter for the depth of the node.
 void setHeight(FixedDimen height)
          Setter for the height of the node.
 void setMove(FixedDimen d)
          Setter for the move value of the node list.
 void setNaturalDepth(FixedDimen depth)
          Setter for the natural depth.
 void setNaturalHeight(FixedDimen height)
          Setter for the natural height.
 void setNaturalWidth(FixedDimen width)
          Setter for the natural width.
 void setShift(FixedDimen d)
          Setter for the shift value of the node list.
 void setTargetDepth(FixedDimen depth)
          Setter for the target depth.
 void setTargetHeight(FixedDimen height)
          Setter for the target height.
 void setTargetWidth(FixedDimen width)
          Setter for the target width.
 void setWidth(FixedDimen width)
          Setter for the width of the node.
 int size()
          Return the size of the NodeList.
 java.lang.String toString()
          This method returns the printable representation.
 void toString(java.lang.StringBuffer sb, java.lang.String prefix, int breadth, int depth)
          This method puts the printable representation into the string buffer. This is meant to produce a exhaustive form as it is used in tracing output to the log file.
 java.lang.String toText()
          Provides a string representation of the current instance.
 void toText(java.lang.StringBuffer sb, java.lang.String prefix)
          Puts a text representation of the object into a string buffer.
 java.lang.Object visit(NodeVisitor visitor, java.lang.Object value)
          This method provides an entry point for the visitor pattern.
 
Methods inherited from class org.extex.typesetter.type.node.AbstractNode
addDepthTo, addHeightTo, addWidthTo, advanceNaturalDepth, advanceNaturalHeight, advanceNaturalWidth, atShipping, computeAdjustment, getLocalizer, getNaturalWidth, getVerticalSize, maxDepth, maxHeight, maxWidth, spreadHeight, spreadWidth, toText
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.extex.typesetter.type.Node
addDepthTo, addHeightTo, addWidthTo, atShipping, getNaturalWidth, getVerticalSize, spreadHeight, spreadWidth
 

Constructor Detail

GenericNodeList

public GenericNodeList()
Creates a new object.

Method Detail

add

public void add(int index,
                Node node)
Add a node to the node list at a given position.

Specified by:
add in interface NodeList
Parameters:
index - the position of insertion
node - the node to add
See Also:
NodeList.add(int, org.extex.typesetter.type.Node)

add

public void add(Node node)
Add a node to the node list. The other attributes (width, height, depth) are not modified.

Specified by:
add in interface NodeList
Parameters:
node - the node to add
See Also:
NodeList.add( org.extex.typesetter.type.Node)

addSkip

public void addSkip(FixedGlue glue)
Add some glue to the node list. The other attributes (width, height, depth) are not modified.

Specified by:
addSkip in interface NodeList
Parameters:
glue - the glue to add
See Also:
NodeList.addSkip( org.extex.core.glue.FixedGlue)

clear

public void clear()
Remove all nodes from the list. The list is empty afterwards. The dimensions are reset to zero unless target sizes are specified. In this case the target sizes are used.

Specified by:
clear in interface NodeList
See Also:
NodeList.clear()

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException

Overrides:
clone in class AbstractNode
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()

copy

public NodeList copy()
Clone the current object.

Specified by:
copy in interface NodeList
Returns:
the copy
See Also:
NodeList.copy()

countChars

public int countChars()
This method determines the number of characters contained in a node.

Specified by:
countChars in interface Node
Overrides:
countChars in class AbstractNode
Returns:
the number of characters contained
See Also:
Node.countChars()

get

public Node get(int index)
Getter for a node at a given position.

Specified by:
get in interface NodeList
Parameters:
index - the position
Returns:
the node at position index of null if index is out of bounds
See Also:
NodeList.get(int)

getChars

public CharNode[] getChars()
Getter for the array of characters enclosed in this node.

Specified by:
getChars in interface Node
Overrides:
getChars in class AbstractNode
Returns:
the array of characters
See Also:
Node.getChars()

getDepth

public FixedDimen getDepth()
Getter for the depth of the node. If a target depth has been set then this target depth is returned. Otherwise the natural depth is returned.

Specified by:
getDepth in interface Node
Overrides:
getDepth in class AbstractNode
Returns:
the depth
See Also:
AbstractNode.getDepth()

getHeight

public FixedDimen getHeight()
Getter for the height of the node. If a target height has been set then this target height is returned. Otherwise the natural height is returned.

Specified by:
getHeight in interface Node
Overrides:
getHeight in class AbstractNode
Returns:
the height
See Also:
AbstractNode.getHeight()

getMove

public Dimen getMove()
Getter for the move value of the node list. The move parameter describes how far from its original position the box is moved leftwards or rightwards. Positive values indicate a move rightwards.

Specified by:
getMove in interface NodeList
Returns:
the move value
See Also:
NodeList.getMove()

getNaturalDepth

public FixedDimen getNaturalDepth()
Getter for the natural depth.

Specified by:
getNaturalDepth in interface Node
Overrides:
getNaturalDepth in class AbstractNode
Returns:
the natural depth
See Also:
Node.getNaturalDepth()

getNaturalHeight

public FixedDimen getNaturalHeight()
Getter for the natural height.

Specified by:
getNaturalHeight in interface Node
Overrides:
getNaturalHeight in class AbstractNode
Returns:
the natural height
See Also:
Node.getNaturalHeight()

getShift

public Dimen getShift()
Getter for the shift value of the node list. The shift parameter describes how far from its original position the box is shifted up or down. Positive values indicate a shift downwards.

Specified by:
getShift in interface NodeList
Returns:
the shift value
See Also:
NodeList.getShift()

getTargetDepth

public Dimen getTargetDepth()
Getter for targetDepth.

Returns:
the targetDepth.

getTargetHeight

public Dimen getTargetHeight()
Getter for targetHeight.

Returns:
the targetHeight.

getTargetWidth

public Dimen getTargetWidth()
Getter for targetWidth.

Returns:
the targetWidth.

getWidth

public FixedDimen getWidth()
Getter for the width of the node. If a target width has been set then this target width is returned. Otherwise the natural width is returned.

Specified by:
getWidth in interface Node
Overrides:
getWidth in class AbstractNode
Returns:
the width
See Also:
AbstractNode.getWidth()

isEmpty

public boolean isEmpty()
Test whether the node list is empty.

Specified by:
isEmpty in interface NodeList
Returns:
true, if the NodeList is empty, otherwise false.

iterator

public java.util.Iterator<Node> iterator()
Get a new iterator for all nodes in the list. This method is just provided for completeness. Consider a conventional loop because of performance issues.

Specified by:
iterator in interface java.lang.Iterable<Node>
Specified by:
iterator in interface NodeList
Returns:
the iterator for all nodes in the list
See Also:
NodeList.iterator()

remove

public Node remove(int index)
Remove an element at a given position. The other attributes (width, height, depth) are not modified.

Specified by:
remove in interface NodeList
Parameters:
index - the position
Returns:
the element previously located at position index
See Also:
NodeList.remove(int)

setDepth

public void setDepth(FixedDimen depth)
Setter for the depth of the node.

Specified by:
setDepth in interface Node
Overrides:
setDepth in class AbstractNode
Parameters:
depth - the node depth
See Also:
AbstractNode.setDepth(org.extex.core.dimen.FixedDimen)

setHeight

public void setHeight(FixedDimen height)
Setter for the height of the node.

Specified by:
setHeight in interface Node
Overrides:
setHeight in class AbstractNode
Parameters:
height - the new height
See Also:
AbstractNode.setHeight(org.extex.core.dimen.FixedDimen)

setMove

public void setMove(FixedDimen d)
Setter for the move value of the node list. The move parameter describes how far from its original position the box is moved leftwards or rightwards. Positive values indicate a move rightwards.

Specified by:
setMove in interface NodeList
Parameters:
d - the move value
See Also:
NodeList.setMove( org.extex.core.dimen.FixedDimen)

setNaturalDepth

public void setNaturalDepth(FixedDimen depth)
Setter for the natural depth.

Parameters:
depth - the natural depth
See Also:
AbstractNode.setDepth( org.extex.core.dimen.FixedDimen)

setNaturalHeight

public void setNaturalHeight(FixedDimen height)
Setter for the natural height.

Parameters:
height - the natural height
See Also:
AbstractNode.setHeight( org.extex.core.dimen.FixedDimen)

setNaturalWidth

public void setNaturalWidth(FixedDimen width)
Setter for the natural width.

Parameters:
width - the natural width
See Also:
AbstractNode.setWidth( org.extex.core.dimen.FixedDimen)

setShift

public void setShift(FixedDimen d)
Setter for the shift value of the node list. The shift parameter describes how far from its original position the box is shifted up or down. Positive values indicate a shift downwards.

Specified by:
setShift in interface NodeList
Parameters:
d - the amount to be shifted
See Also:
NodeList.setShift( org.extex.core.dimen.FixedDimen)

setTargetDepth

public void setTargetDepth(FixedDimen depth)
Setter for the target depth.

Parameters:
depth - the target depth to set.

setTargetHeight

public void setTargetHeight(FixedDimen height)
Setter for the target height.

Parameters:
height - the target height to set.

setTargetWidth

public void setTargetWidth(FixedDimen width)
Setter for the target width.

Parameters:
width - the target width to set.

setWidth

public void setWidth(FixedDimen width)
Setter for the width of the node.

Specified by:
setWidth in interface Node
Overrides:
setWidth in class AbstractNode
Parameters:
width - the new width
See Also:
AbstractNode.setWidth( org.extex.core.dimen.FixedDimen)

size

public int size()
Return the size of the NodeList.

Specified by:
size in interface NodeList
Returns:
the size of the NodeList

toString

public java.lang.String toString()
This method returns the printable representation. This is meant to produce a exhaustive form as it is used in tracing output to the log file.

Overrides:
toString in class AbstractNode
Returns:
the printable representation
See Also:
Object.toString()

toString

public void toString(java.lang.StringBuffer sb,
                     java.lang.String prefix,
                     int breadth,
                     int depth)
This method puts the printable representation into the string buffer. This is meant to produce a exhaustive form as it is used in tracing output to the log file.

Specified by:
toString in interface Node
Specified by:
toString in interface NodeList
Overrides:
toString in class AbstractNode
Parameters:
sb - the output string buffer
prefix - the prefix string inserted at the beginning of each line
breadth - the breadth of the nodes to display
depth - the depth of the nodes to display
See Also:
AbstractNode.toString(java.lang.StringBuffer, java.lang.String, int, int)

toText

public java.lang.String toText()
Provides a string representation of the current instance.

Specified by:
toText in interface NodeList
Returns:
the String representation of the object
See Also:
"TeX – The Program [182]"

toText

public void toText(java.lang.StringBuffer sb,
                   java.lang.String prefix)
Puts a text representation of the object into a string buffer.

Specified by:
toText in interface Node
Overrides:
toText in class AbstractNode
Parameters:
sb - the output string buffer
prefix - the string prepended to each line of the resulting text
See Also:
Node.toText(java.lang.StringBuffer, java.lang.String)

visit

public java.lang.Object visit(NodeVisitor visitor,
                              java.lang.Object value)
                       throws GeneralException
This method provides an entry point for the visitor pattern.

Specified by:
visit in interface Node
Parameters:
visitor - the visitor to apply
value - the argument for the visitor
Returns:
the result of the method invocation of the visitor
Throws:
GeneralException - in case of an error
See Also:
Node.visit( org.extex.typesetter.type.NodeVisitor, java.lang.Object)