de.dante.extex.typesetter.type.node
Class GenericNodeList

java.lang.Object
  extended byde.dante.extex.typesetter.type.node.AbstractNode
      extended byde.dante.extex.typesetter.type.node.GenericNodeList
All Implemented Interfaces:
java.lang.Cloneable, Node, NodeList, java.io.Serializable
Direct Known Subclasses:
HorizontalListNode, VerticalListNode

public class GenericNodeList
extends AbstractNode
implements NodeList

Abstract base class for all NodeLists.

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

Field Summary
 
Fields inherited from class de.dante.extex.typesetter.type.node.AbstractNode
NO_CHARS
 
Constructor Summary
GenericNodeList()
          Creates a new object.
GenericNodeList(Node node)
          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.
 Node atShipping(Context context, Typesetter typesetter, NodeVisitor visitor, boolean inHMode)
          This method performs any action which are required to executed at the time of shipping the node to the DocumentWriter.
 void clear()
          Remove all nodes from the list.
 NodeList copy()
          Clone the current object.
 int countChars()
          This method determines the number of characters contained in a node.
 boolean empty()
          Test whether the node list is empty.
 Node get(int index)
          Getter for a node at a given position.
 CharNode[] getChars()
          Getter for the array of characters enclosed in this node.
 Dimen getMove()
          Getter for the move value of the node list.
 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.
 NodeIterator iterator()
          Get a new iterator for all nodes in the list.
 Node remove(int index)
          Remove an element at a given position.
 void setMove(FixedDimen d)
          Setter for the move value of the node list.
 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.
 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)
          Print the node possibly truncated in breadth and depth.
 java.lang.String toText()
          Provides a string representation of the current instance.
 void toText(java.lang.StringBuffer sb, java.lang.String prefix)
          This method puts the printable representation into the 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 de.dante.extex.typesetter.type.node.AbstractNode
addDepthTo, addHeightTo, addWidthTo, advanceDepth, advanceHeight, advanceWidth, computeAdjustment, getDepth, getHeight, getLocalizer, getVerticalSize, getWidth, maxDepth, maxHeight, maxWidth, setDepth, setHeight, setWidth, spreadHeight, spreadWidth, toText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.dante.extex.typesetter.type.Node
addDepthTo, addHeightTo, addWidthTo, getDepth, getHeight, getVerticalSize, getWidth, setDepth, setHeight, setWidth, spreadHeight, spreadWidth
 

Constructor Detail

GenericNodeList

public GenericNodeList()
Creates a new object.


GenericNodeList

public GenericNodeList(Node node)
Creates a new object. The list is filled with the node given.

Parameters:
node - the node to add initially
Method Detail

add

public void add(int index,
                Node node)
Description copied from interface: NodeList
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, de.dante.extex.typesetter.type.Node)

add

public void add(Node node)
Description copied from interface: NodeList
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( de.dante.extex.typesetter.type.Node)

addSkip

public void addSkip(FixedGlue glue)
Description copied from interface: NodeList
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( de.dante.extex.interpreter.type.glue.FixedGlue)

atShipping

public Node atShipping(Context context,
                       Typesetter typesetter,
                       NodeVisitor visitor,
                       boolean inHMode)
                throws GeneralException
Description copied from interface: Node
This method performs any action which are required to executed at the time of shipping the node to the DocumentWriter. It is a NOOP in the abstract base class and should be overwritten by sub-classes if required.

Specified by:
atShipping in interface Node
Overrides:
atShipping in class AbstractNode
Parameters:
context - the interpreter context
typesetter - the typesetter
visitor - the node visitor to be invoked when the node is hit. Note that each node in the output page is visited this way. Thus there is no need to implement a node traversal for the NodeList types
inHMode - true iff the container is a horizontal list. Otherwise the container is a vertical list
Returns:
the node to be used instead of the current one in the output list. If the value is null then the node is deleted. If the value is the node itself then it is preserved.
Throws:
GeneralException - in case of an error
See Also:
Node.atShipping( de.dante.extex.interpreter.context.Context, de.dante.extex.typesetter.Typesetter, de.dante.extex.typesetter.type.NodeVisitor, boolean)

clear

public void clear()
Description copied from interface: NodeList
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()

copy

public NodeList copy()
Description copied from interface: NodeList
Clone the current object.

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

countChars

public int countChars()
Description copied from interface: Node
This method determines the number of characters contained in a node.

Specified by:
countChars in interface Node
Overrides:
countChars in class AbstractNode
See Also:
Node.countChars()

empty

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

Returns:
true, if the NodeList is empty, otherwise false.

get

public Node get(int index)
Description copied from interface: NodeList
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()
Description copied from interface: Node
Getter for the array of characters enclosed in this node.

Specified by:
getChars in interface Node
Overrides:
getChars in class AbstractNode
See Also:
Node.getChars()

getMove

public Dimen getMove()
Description copied from interface: NodeList
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()

getShift

public Dimen getShift()
Description copied from interface: NodeList
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.

iterator

public NodeIterator iterator()
Description copied from interface: NodeList
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 NodeList
Returns:
the iterator for all nodes in the list
See Also:
NodeList.iterator()

remove

public Node remove(int index)
Description copied from interface: NodeList
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)

setMove

public void setMove(FixedDimen d)
Description copied from interface: NodeList
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( de.dante.extex.interpreter.type.dimen.FixedDimen)

setShift

public void setShift(FixedDimen d)
Description copied from interface: NodeList
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( de.dante.extex.interpreter.type.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.

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()
Description copied from class: AbstractNode
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)
Description copied from interface: NodeList
Print the node possibly truncated in breadth and depth.

Specified by:
toString in interface NodeList
Overrides:
toString in class AbstractNode
See Also:
Node.toString(java.lang.StringBuffer, java.lang.String, int, int)

toText

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

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)
Description copied from interface: Node
This method puts the printable representation into the string buffer. This is meant to produce a short form only as it is used in error messages to the user.

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
Description copied from interface: Node
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( de.dante.extex.typesetter.type.NodeVisitor, java.lang.Object)