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

java.lang.Object
  extended byde.dante.extex.typesetter.type.node.AbstractNode
      extended byde.dante.extex.typesetter.type.node.CharNode
          extended byde.dante.extex.typesetter.type.node.VirtualCharNode
All Implemented Interfaces:
java.lang.Cloneable, Node, NodeList, java.io.Serializable

public class VirtualCharNode
extends CharNode
implements NodeList

This class exposes itself as character node but contains an hlist internally. This class is used to represent composed characters from virtual fonts.

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

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
 
Fields inherited from class de.dante.extex.typesetter.type.node.AbstractNode
NO_CHARS
 
Constructor Summary
VirtualCharNode(TypesettingContext context, UnicodeChar uc)
          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 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.
 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.
 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.
 NodeList getNodes()
          Getter for nodes.
 Dimen getShift()
          Getter for the shift value of the node list.
 FixedDimen getVerticalSize()
          Compute the vertical size of a node.
 FixedDimen getWidth()
          Getter for the width of the node.
 NodeIterator 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 setShift(FixedDimen d)
          Setter for the shift value of the node list.
 void setWidth(FixedDimen width)
          Setter for the width of the node.
 int size()
          Getter for the number of elements of the list.
 void spreadWidth(FixedDimen width, FixedGlueComponent sum)
          Adjust the width of a flexible node.
 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.CharNode
getCharacter, getGlyph, getSpaceFactor, getTypesettingContext, toString, toText
 
Methods inherited from class de.dante.extex.typesetter.type.node.AbstractNode
addDepthTo, addHeightTo, advanceDepth, advanceHeight, advanceWidth, computeAdjustment, getLocalizer, maxDepth, maxHeight, maxWidth, spreadHeight, toString, 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.NodeList
toString
 
Methods inherited from interface de.dante.extex.typesetter.type.Node
addDepthTo, addHeightTo, spreadHeight, toText
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail

VirtualCharNode

public VirtualCharNode(TypesettingContext context,
                       UnicodeChar uc)
Creates a new object.

Parameters:
context - the typesetting context
uc - the character represented by this node
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)

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
Overrides:
addWidthTo in class AbstractNode
See Also:
AbstractNode.addWidthTo( de.dante.extex.interpreter.type.glue.WideGlue)

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 CharNode
See Also:
CharNode.countChars()

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 CharNode
See Also:
CharNode.getChars()

getDepth

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

Specified by:
getDepth in interface Node
Overrides:
getDepth in class AbstractNode
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
Overrides:
getHeight in class AbstractNode
See Also:
Node.getHeight()

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

getNodes

public NodeList getNodes()
Getter for nodes.

Returns:
the nodes

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

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
Overrides:
getVerticalSize in class AbstractNode
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
Overrides:
getWidth in class AbstractNode
See Also:
Node.getWidth()

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)

setDepth

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

Specified by:
setDepth in interface Node
Overrides:
setDepth in class AbstractNode
See Also:
Node.setDepth( de.dante.extex.interpreter.type.dimen.FixedDimen)

setHeight

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

Specified by:
setHeight in interface Node
Overrides:
setHeight in class AbstractNode
See Also:
Node.setHeight( de.dante.extex.interpreter.type.dimen.FixedDimen)

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)

setWidth

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

Specified by:
setWidth in interface Node
Overrides:
setWidth in class AbstractNode
See Also:
Node.setWidth( de.dante.extex.interpreter.type.dimen.FixedDimen)

size

public int size()
Description copied from interface: NodeList
Getter for the number of elements of the list.

Specified by:
size in interface NodeList
Returns:
the length of the list
See Also:
NodeList.size()

spreadWidth

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

Specified by:
spreadWidth in interface Node
Overrides:
spreadWidth in class AbstractNode
Parameters:
width - 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)

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
Overrides:
visit in class CharNode
Throws:
GeneralException
See Also:
Node.visit( de.dante.extex.typesetter.type.NodeVisitor, java.lang.Object)