org.extex.typesetter.type.node
Class VirtualCharNode

java.lang.Object
  extended by org.extex.typesetter.type.node.AbstractNode
      extended by org.extex.typesetter.type.node.CharNode
          extended by org.extex.typesetter.type.node.VirtualCharNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Node>, Node, NodeList

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: 4739 $
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 org.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.
 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.
 boolean isEmpty()
          Test whether the node list is empty.
 java.util.Iterator<Node> 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.String toString()
          This method returns the printable representation.
 java.lang.String toText()
          Provides a string representation of the current instance.
 java.lang.Object visit(NodeVisitor visitor, java.lang.Object value)
          This method provides an entry point for the visitor pattern.
 
Methods inherited from class org.extex.typesetter.type.node.CharNode
getCharacter, getSpaceFactor, getTypesettingContext, toString, toText
 
Methods inherited from class org.extex.typesetter.type.node.AbstractNode
addDepthTo, addHeightTo, advanceNaturalDepth, advanceNaturalHeight, advanceNaturalWidth, atShipping, clone, computeAdjustment, getLocalizer, getNaturalDepth, getNaturalHeight, getNaturalWidth, maxDepth, maxHeight, maxWidth, spreadHeight, toText
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.extex.typesetter.type.NodeList
toString
 
Methods inherited from interface org.extex.typesetter.type.Node
addDepthTo, addHeightTo, atShipping, getNaturalDepth, getNaturalHeight, getNaturalWidth, 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)
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, org.extex.typesetter.type.Node)

add

public void add(Node node)
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( org.extex.typesetter.type.Node)

addSkip

public void addSkip(FixedGlue glue)
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( org.extex.core.glue.FixedGlue)

addWidthTo

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

Specified by:
addWidthTo in interface Node
Overrides:
addWidthTo in class AbstractNode
Parameters:
glue - the glue to add to.
See Also:
AbstractNode.addWidthTo( org.extex.core.glue.WideGlue)

clear

public void clear()
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()
Clone the current object.

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

countChars

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

Specified by:
countChars in interface Node
Overrides:
countChars in class CharNode
Returns:
the number of characters contained
See Also:
CharNode.countChars()

get

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

Specified by:
getChars in interface Node
Overrides:
getChars in class CharNode
Returns:
the array of characters
See Also:
CharNode.getChars()

getDepth

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

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

getHeight

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

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

getMove

public Dimen getMove()
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()
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()
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.

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

getWidth

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

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

isEmpty

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

Specified by:
isEmpty in interface NodeList
Returns:
true, if the NodeList is empty, otherwise false.
See Also:
NodeList.isEmpty()

iterator

public java.util.Iterator<Node> iterator()
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 java.lang.Iterable<Node>
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)
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)
Setter for the depth of the node.

Specified by:
setDepth in interface Node
Overrides:
setDepth in class AbstractNode
Parameters:
depth - the node depth
See Also:
Node.setDepth( org.extex.core.dimen.FixedDimen)

setHeight

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

Specified by:
setHeight in interface Node
Overrides:
setHeight in class AbstractNode
Parameters:
height - the new height
See Also:
Node.setHeight( org.extex.core.dimen.FixedDimen)

setMove

public void setMove(FixedDimen d)
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( org.extex.core.dimen.FixedDimen)

setShift

public void setShift(FixedDimen d)
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( org.extex.core.dimen.FixedDimen)

setWidth

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

Specified by:
setWidth in interface Node
Overrides:
setWidth in class AbstractNode
Parameters:
width - the new width
See Also:
Node.setWidth( org.extex.core.dimen.FixedDimen)

size

public int size()
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)
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( org.extex.core.dimen.FixedDimen, org.extex.core.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.

Overrides:
toString in class AbstractNode
Returns:
the printable representation
See Also:
AbstractNode.toString()

toText

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

Specified by:
toText in interface NodeList
Returns:
the String representation of the object
See Also:
NodeList.toText()

visit

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

Specified by:
visit in interface Node
Overrides:
visit in class CharNode
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( org.extex.typesetter.type.NodeVisitor, java.lang.Object)