org.extex.typesetter.type
Interface Node

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
KernNode, NodeList, OrientedNode, OrientedNodeList, SkipNode
All Known Implementing Classes:
AbstractExpandableNode, AbstractKernNode, AbstractLeadersNode, AbstractNode, AccentKernNode, AdjustNode, AfterMathNode, AlignedLeadersNode, BeforeMathNode, CenteredLeadersNode, CharNode, DiscretionaryNode, ExpandedLeadersNode, ExplicitKernNode, ExtensionNode, GenericNodeList, GlueNode, HorizontalListNode, ImageNode, ImplicitKernNode, InsertionNode, LigatureNode, MarkNode, PdfAnnotation, PdfDest, PdfEndLink, PdfEndThread, PdfLiteral, PdfObject, PdfRefObj, PdfRefXForm, PdfRefXImage, PdfStartLink, PdfThread, PdfXForm, PdfXImage, PenaltyNode, RuleNode, SpaceNode, SpecialNode, VerticalListNode, VirtualCharNode, WhatsItCloseNode, WhatsItNode, WhatsItOpenNode, WhatsItWriteNode

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: 4739 $
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(PageContext context, Typesetter typesetter, FixedDimen posX, FixedDimen posY)
          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 getNaturalDepth()
          Getter for the natural depth of the node.
 FixedDimen getNaturalHeight()
          Getter for the natural height of the node.
 FixedDimen getNaturalWidth()
          Getter for the natural width 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

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

Parameters:
glue - the glue to add to.

addHeightTo

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

Parameters:
glue - the glue to add to.

addWidthTo

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

Parameters:
glue - the glue to add to.

atShipping

Node atShipping(PageContext context,
                Typesetter typesetter,
                FixedDimen posX,
                FixedDimen posY)
                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 encapsulated as page context
typesetter - the typesetter
posX - the horizontal position on the page
posY - the vertical position on the page
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

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

Returns:
the number of characters contained

getChars

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

Returns:
the array of characters

getDepth

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

Returns:
the depth

getHeight

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

Returns:
the height

getNaturalDepth

FixedDimen getNaturalDepth()
Getter for the natural depth of the node.

Returns:
the natural depth

getNaturalHeight

FixedDimen getNaturalHeight()
Getter for the natural height of the node.

Returns:
the natural height

getNaturalWidth

FixedDimen getNaturalWidth()
Getter for the natural width of the node.

Returns:
the natural width

getVerticalSize

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

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

Returns:
the width

setDepth

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

Parameters:
depth - the node depth

setHeight

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

Parameters:
height - the new height

setWidth

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

Parameters:
width - the new width

spreadHeight

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

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

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

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

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