de.dante.extex.typesetter.type
Interface Node

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
KernNode, NodeList, SkipNode
All Known Implementing Classes:
AbstractKernNode, AbstractNode, AdjustNode, AlignedLeadersNode, CenteredLeadersNode, DiscretionaryNode, ExpandedLeadersNode, ExtensionNode, GenericNodeList, GlueNode, ImageNode, InsertionNode, LigatureNode, MarkNode, PenaltyNode, RuleNode, SpaceNode, SpecialNode, VerticalListNode, VirtualCharNode

public interface Node
extends java.io.Serializable

A node is the basic data structure for the typesetter. It has a reference point and three dimensions, namely width, height, and depth (see figure).

Note that those dimensions are sometimes used for different purposes. For instance a KernNode does use the width to denote the actual size which can be applied in horizontal or in vertical direction, depending on the context.

Version:
$Revision: 1.21 $
Author:
Gerd Neugebauer, Michael Niedermair

Method Summary
 void addDepthTo(WideGlue glue)
          Add the flexible depth of the current node to the given glue.
 void addHeightTo(WideGlue glue)
          Add the flexible height of the current node to the given glue.
 void addWidthTo(WideGlue glue)
          Add the flexible width of the current node to the given glue.
 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.
 int countChars()
          This method determines the number of characters contained in a node.
 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.
 FixedDimen getVerticalSize()
          Compute the vertical size of a node.
 FixedDimen getWidth()
          Getter for the width of the node.
 void setDepth(FixedDimen depth)
          Setter for the depth of the node.
 void setHeight(FixedDimen height)
          Setter for the height of the node.
 void setWidth(FixedDimen width)
          Setter for the width of the node.
 void spreadHeight(FixedDimen height, FixedGlueComponent sum)
          Adjust the height of a flexible node.
 void spreadWidth(FixedDimen width, FixedGlueComponent sum)
          Adjust the width of a flexible node.
 void toString(java.lang.StringBuffer sb, java.lang.String prefix, int breadth, int depth)
          This method puts the printable representation into the string buffer.
 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.
 

Method Detail

addDepthTo

public void addDepthTo(WideGlue glue)
Add the flexible depth of the current node to the given glue.

Parameters:
glue - the glue to add to.

addHeightTo

public void addHeightTo(WideGlue glue)
Add the flexible height of the current node to the given glue.

Parameters:
glue - the glue to add to.

addWidthTo

public void addWidthTo(WideGlue glue)
Add the flexible width of the current node to the given glue.

Parameters:
glue - the glue to add to.

atShipping

public Node atShipping(Context context,
                       Typesetter typesetter,
                       NodeVisitor visitor,
                       boolean inHMode)
                throws GeneralException
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.

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

countChars

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

Returns:
the number of characters contained

getChars

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

Returns:
the array of characters

getDepth

public FixedDimen getDepth()
Getter for the depth of the node.

Returns:
the depth

getHeight

public FixedDimen getHeight()
Getter for the height of the node.

Returns:
the height

getVerticalSize

public FixedDimen getVerticalSize()
Compute the vertical size of a node. The vertical size is the size of the box enclosing the bounding box and containing the base line (see figure).

Returns:
the vertical size

getWidth

public FixedDimen getWidth()
Getter for the width of the node.

Returns:
the width

setDepth

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

Parameters:
depth - the node depth

setHeight

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

Parameters:
height - the new height

setWidth

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

Parameters:
width - the new width

spreadHeight

public void spreadHeight(FixedDimen height,
                         FixedGlueComponent sum)
Adjust the height of a flexible node. This method is a noop for any but the flexible nodes.

Parameters:
height - the desired height
sum - the total sum of the glues

spreadWidth

public void spreadWidth(FixedDimen width,
                        FixedGlueComponent sum)
Adjust the width of a flexible node. This method is a noop for any but the flexible nodes.

Parameters:
width - the desired width
sum - the total sum of the glues

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.

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

toText

public void toText(java.lang.StringBuffer sb,
                   java.lang.String prefix)
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.

Parameters:
sb - the output string buffer
prefix - the prefix string inserted at the beginning of each line

visit

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

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