de.dante.extex.typesetter.type.node fight-scam.com
Class AbstractNode

java.lang.Object
  extended byde.dante.extex.typesetter.type.node.AbstractNode
All Implemented Interfaces:
Node, java.io.Serializable
Direct Known Subclasses:
AbstractExpandableNode, AbstractKernNode, AdjustNode, AfterMathNode, BeforeMathNode, CharNode, DiscretionaryNode, GenericNodeList, InsertionNode, MarkNode, PenaltyNode, RuleNode, WhatsItNode

public abstract class AbstractNode
extends java.lang.Object
implements Node

This abstract class provides some methods common to all Nodes.

Version:
$Revision: 1.21 $
Author:
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
protected static CharNode[] NO_CHARS
          The constant NO_CHAR contains the empty array of CharNode.
 
Constructor Summary
AbstractNode()
          Creates a new object.
AbstractNode(FixedDimen aWidth)
          Creates a new object.
AbstractNode(FixedDimen aWidth, FixedDimen aHeight, FixedDimen aDepth)
          Creates a new object.
 
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.
 void advanceDepth(FixedDimen x)
          Advance the depth by some length.
 void advanceHeight(FixedDimen x)
          Advance the height by some length.
 void advanceWidth(FixedDimen x)
          Advance the width by some length.
 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.
protected  long computeAdjustment(long size, FixedGlue glue, FixedGlueComponent sum)
          Compute the amount of adjustment needed to achieve a certain size.
 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.
protected  Localizer getLocalizer()
          Getter for localizer.
 FixedDimen getVerticalSize()
          Compute the vertical size of a node.
 FixedDimen getWidth()
          Getter for the width of the node.
 void maxDepth(FixedDimen x)
          Assign the maximum of the current value and a comparison value to the depth.
 void maxHeight(FixedDimen x)
          Assign the maximum of the current value and a comparison value to the height.
 void maxWidth(FixedDimen x)
          Assign the maximum of the current value and a comparison value to the width.
 void setDepth(FixedDimen glue)
          Setter for the depth of the node.
 void setHeight(FixedDimen glue)
          Setter for the height of the node.
 void setWidth(FixedDimen glue)
          Setter for the width of the node.
 void spreadHeight(FixedDimen h, FixedGlueComponent sum)
          Adjust the height of a flexible node.
 void spreadWidth(FixedDimen w, FixedGlueComponent sum)
          Adjust the width of a flexible node.
 java.lang.String toString()
          This method returns the printable representation.
 void toString(java.lang.StringBuffer sb, java.lang.String prefix, int b, int d)
          This method puts the printable representation into the string buffer.
protected  java.lang.String toText(java.lang.String prefix)
          Compute a text representation of this object.
 void toText(java.lang.StringBuffer sb, java.lang.String prefix)
          Puts a text representation of the object into a string buffer.
 
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
visit
 

Field Detail

NO_CHARS

protected static final CharNode[] NO_CHARS
The constant NO_CHAR contains the empty array of CharNode.

Constructor Detail

AbstractNode

public AbstractNode()
Creates a new object. All dimensions (width, height, depth) are initially set to 0pt.


AbstractNode

public AbstractNode(FixedDimen aWidth)
Creates a new object.

Parameters:
aWidth - the width of the node

AbstractNode

public AbstractNode(FixedDimen aWidth,
                    FixedDimen aHeight,
                    FixedDimen aDepth)
Creates a new object.

Parameters:
aWidth - the width of the node
aHeight - the height of the node
aDepth - the depth of the node
Method Detail

addDepthTo

public void addDepthTo(WideGlue glue)
Description copied from interface: Node
Add the flexible depth of the current node to the given glue.

Specified by:
addDepthTo in interface Node
Parameters:
glue - the glue to add to.
See Also:
Node.addDepthTo( de.dante.extex.interpreter.type.glue.WideGlue)

addHeightTo

public void addHeightTo(WideGlue glue)
Description copied from interface: Node
Add the flexible height of the current node to the given glue.

Specified by:
addHeightTo in interface Node
Parameters:
glue - the glue to add to.
See Also:
Node.addHeightTo( de.dante.extex.interpreter.type.glue.WideGlue)

addWidthTo

public void addWidthTo(WideGlue glue)
Description copied from interface: Node
Add the flexible width of the current node to the given glue.

Specified by:
addWidthTo in interface Node
Parameters:
glue - the glue to add to.
See Also:
Node.addWidthTo( de.dante.extex.interpreter.type.glue.WideGlue)

advanceDepth

public void advanceDepth(FixedDimen x)
Advance the depth by some length. The length can also be negative.

Parameters:
x - the length to add

advanceHeight

public void advanceHeight(FixedDimen x)
Advance the height by some length. The length can also be negative.

Parameters:
x - the length to add

advanceWidth

public void advanceWidth(FixedDimen x)
Advance the width by some length. The length can also be negative.

Parameters:
x - the length to add

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.

Specified by:
atShipping in interface Node
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)

computeAdjustment

protected long computeAdjustment(long size,
                                 FixedGlue glue,
                                 FixedGlueComponent sum)
Compute the amount of adjustment needed to achieve a certain size.

Parameters:
size - the current size in scaled points
glue - the glue
sum - the total stretchability or shrinkability
Returns:
the adjustment

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
Returns:
the number of characters contained
See Also:
Node.countChars()

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
Returns:
the array of characters
See Also:
Node.getChars()

getDepth

public FixedDimen getDepth()
Description copied from interface: Node
Getter for the depth of the node.

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

getHeight

public FixedDimen getHeight()
Description copied from interface: Node
Getter for the height of the node.

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

getLocalizer

protected Localizer getLocalizer()
Getter for localizer.

Returns:
the localizer

getVerticalSize

public FixedDimen getVerticalSize()
Description copied from interface: Node
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).

Specified by:
getVerticalSize in interface Node
Returns:
the vertical size
See Also:
Node.getVerticalSize()

getWidth

public FixedDimen getWidth()
Description copied from interface: Node
Getter for the width of the node.

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

maxDepth

public void maxDepth(FixedDimen x)
Assign the maximum of the current value and a comparison value to the depth.

Parameters:
x - the length to compare to

maxHeight

public void maxHeight(FixedDimen x)
Assign the maximum of the current value and a comparison value to the height.

Parameters:
x - the length to compare to

maxWidth

public void maxWidth(FixedDimen x)
Assign the maximum of the current value and a comparison value to the width.

Parameters:
x - the length to compare to

setDepth

public void setDepth(FixedDimen glue)
Description copied from interface: Node
Setter for the depth of the node.

Specified by:
setDepth in interface Node
Parameters:
glue - the node depth
See Also:
Node.setDepth( de.dante.extex.interpreter.type.dimen.FixedDimen)

setHeight

public void setHeight(FixedDimen glue)
Description copied from interface: Node
Setter for the height of the node.

Specified by:
setHeight in interface Node
Parameters:
glue - the new height
See Also:
Node.setHeight( de.dante.extex.interpreter.type.dimen.FixedDimen)

setWidth

public void setWidth(FixedDimen glue)
Description copied from interface: Node
Setter for the width of the node.

Specified by:
setWidth in interface Node
Parameters:
glue - the new width
See Also:
Node.setWidth( de.dante.extex.interpreter.type.dimen.FixedDimen)

spreadHeight

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

Specified by:
spreadHeight in interface Node
Parameters:
h - the desired height
sum - the total sum of the glues
See Also:
Node.spreadHeight( de.dante.extex.interpreter.type.dimen.FixedDimen, de.dante.extex.interpreter.type.glue.FixedGlueComponent)

spreadWidth

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

Specified by:
spreadWidth in interface Node
Parameters:
w - the desired width
sum - the total sum of the glues
See Also:
Node.spreadWidth( de.dante.extex.interpreter.type.dimen.FixedDimen, de.dante.extex.interpreter.type.glue.FixedGlueComponent)

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.

Returns:
the printable representation

toString

public void toString(java.lang.StringBuffer sb,
                     java.lang.String prefix,
                     int b,
                     int d)
Description copied from interface: Node
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
Parameters:
sb - the output string buffer
prefix - the prefix string inserted at the beginning of each line
b - the breadth of the nodes to display
d - the depth of the nodes to display
See Also:
Node.toString( java.lang.StringBuffer, java.lang.String, int, int)

toText

protected java.lang.String toText(java.lang.String prefix)
Compute a text representation of this object.

Parameters:
prefix - the string prepended to each line of the resulting text
Returns:
the text representation of this object

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
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)