Class AbstractGRWrappedTextVisitor

java.lang.Object
  |
  +--AbstractGRWrappedTextVisitor
All Implemented Interfaces:
GRVisitor
Direct Known Subclasses:
GRWrappedLaTeXVisitor, GRWrappedMapleVisitor, GRWrappedRacahVisitor, GRWrappedStringVisitor

public abstract class AbstractGRWrappedTextVisitor
extends java.lang.Object
implements GRVisitor

Abstract class implementing common functionality between visitors creating a wrapped text representation of a GenRecoupCoeff in some format. This class implements some basic wrapping functionality based on the length in characters if no font is specified, or in pixels if a font is specified. The generated text is held internally as a StringBuffer.

See Also:
GRVisitor, GenRecoupCoeff

Field Summary
protected  java.lang.StringBuffer wrappedstring
          Stores the wrapped String representation under construction.
 
Constructor Summary
AbstractGRWrappedTextVisitor()
          Constructs a new AbstractGRWrappedTextVisitor.
AbstractGRWrappedTextVisitor(int wrapsize)
          Constructs a new AbstractGRWrappedTextVisitor which wraps at wrapsize characters.
AbstractGRWrappedTextVisitor(int wrapsize, java.awt.FontMetrics fm)
          Constructs a new AbstarctGRWrappedTextVisitor, with given wrapsize in pixels and the FontMetrics class for the used font.
 
Method Summary
protected  void append(java.lang.String s)
          Appends the given String to the generated String as one entity on a line, wrapping on demand.
protected  int size(java.lang.String s)
          Returns the size of the given string in pixels when a font is specified, otherwise the length is returned.
protected  void wrap()
          Puts a newline in the generated String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface GRVisitor
result, visitGenRecoupCoeff, visitGR6jSymbol, visitGRCompoundFactor, visitGRKrDelta, visitGRPreFactor, visitGRSummation
 

Field Detail

wrappedstring

protected java.lang.StringBuffer wrappedstring
Stores the wrapped String representation under construction.

Constructor Detail

AbstractGRWrappedTextVisitor

public AbstractGRWrappedTextVisitor()
Constructs a new AbstractGRWrappedTextVisitor. Default wrapsize is 80 characters.


AbstractGRWrappedTextVisitor

public AbstractGRWrappedTextVisitor(int wrapsize)
Constructs a new AbstractGRWrappedTextVisitor which wraps at wrapsize characters.

Parameters:
wrapsize - number of allowed chars on one line

AbstractGRWrappedTextVisitor

public AbstractGRWrappedTextVisitor(int wrapsize,
                                    java.awt.FontMetrics fm)
Constructs a new AbstarctGRWrappedTextVisitor, with given wrapsize in pixels and the FontMetrics class for the used font.

Parameters:
wrapsize - number of allowed pixels on a line
Method Detail

wrap

protected void wrap()
Puts a newline in the generated String.


append

protected void append(java.lang.String s)
Appends the given String to the generated String as one entity on a line, wrapping on demand.

Parameters:
s - the String to be appended as one entity

size

protected int size(java.lang.String s)
Returns the size of the given string in pixels when a font is specified, otherwise the length is returned.

Parameters:
s - string of which the size needs to be calculated
Returns:
the size in pixels if a font is specified, otherwise the length of the given string