de.dante.extex.interpreter.type.math
Class MathClass

java.lang.Object
  extended byde.dante.extex.interpreter.type.math.MathClass
All Implemented Interfaces:
java.io.Serializable

public abstract class MathClass
extends java.lang.Object
implements java.io.Serializable

This class provides the classification of mathematical characters. In fact it is a finite enumeration which exposes the values as constants.

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

Field Summary
static MathClass BINARY
          The field BINARY contains the instance representing the binary class.
static MathClass CLOSING
          The field CLOSING contains the instance representing the closing class.
static MathClass LARGE
          The field LARGE contains the instance representing the large class.
static MathClass OPENING
          The field OPENING contains the instance representing the opening class.
static MathClass ORDINARY
          The field ORDINARY contains the instance representing the ordinary class.
static MathClass PUNCTUATION
          The field PUNCTUATION contains the instance representing the punctation class.
static MathClass RELATION
          The field RELATION contains the instance representing the relation class.
static MathClass VARIABLE
          The field VARIABLE contains the instance representing the variable width class.
 
Constructor Summary
protected MathClass()
          Creates a new object.
 
Method Summary
static MathClass getMathClass(int n)
          Factory method for the math class which maps the TeX encoding into the appropriate instance.
static MathClass parse(Context context, TokenSource source, Typesetter typesetter, java.lang.String primitive)
          Parse a math class.
 java.lang.String toString()
           
abstract  void toString(java.lang.StringBuffer sb)
          Append the printable representation of the current instance to the string buffer.
abstract  java.lang.Object visit(MathClassVisitor visitor, java.lang.Object arg, java.lang.Object arg2)
          Call a method in the visitor depending on the type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BINARY

public static final MathClass BINARY
The field BINARY contains the instance representing the binary class. This class has the code 2 in TeX.


CLOSING

public static final MathClass CLOSING
The field CLOSING contains the instance representing the closing class. This class has the code 5 in TeX.


LARGE

public static final MathClass LARGE
The field LARGE contains the instance representing the large class. This class has the code 1 in TeX.


OPENING

public static final MathClass OPENING
The field OPENING contains the instance representing the opening class. This class has the code 4 in TeX.


ORDINARY

public static final MathClass ORDINARY
The field ORDINARY contains the instance representing the ordinary class. This class has the code 0 in TeX.


PUNCTUATION

public static final MathClass PUNCTUATION
The field PUNCTUATION contains the instance representing the punctation class. This class has the code 6 in TeX.


RELATION

public static final MathClass RELATION
The field RELATION contains the instance representing the relation class. This class has the code 3 in TeX.


VARIABLE

public static final MathClass VARIABLE
The field VARIABLE contains the instance representing the variable width class. This class has the code 7 in TeX.

Constructor Detail

MathClass

protected MathClass()
Creates a new object. The constructor is protected to be open for extensions in the future.

Method Detail

getMathClass

public static final MathClass getMathClass(int n)
Factory method for the math class which maps the TeX encoding into the appropriate instance. The following table gives a mapping from TeX numbers to instances:
0 ORDINARY
1 LARGE
2 BINARY
3 RELATION
4 OPENING
5 CLOSING
6 PUNCTATION
7 VARIABLE

Parameters:
n - the TeX encoded index of the class
Returns:
the MathClass instance corresponding to the TeX code

parse

public static MathClass parse(Context context,
                              TokenSource source,
                              Typesetter typesetter,
                              java.lang.String primitive)
                       throws InterpreterException
Parse a math class.
  open 22 `[ 1 `(
 

Parameters:
context - the interpreter context
source - the token source to read from
typesetter - the typesetter
primitive - the name of the primitive for error handling
Returns:
the MathDelimiter acquired
Throws:
InterpreterException - in case of an error

toString

public abstract void toString(java.lang.StringBuffer sb)
Append the printable representation of the current instance to the string buffer.

Parameters:
sb - the target string buffer

toString

public java.lang.String toString()
See Also:
Object.toString()

visit

public abstract java.lang.Object visit(MathClassVisitor visitor,
                                       java.lang.Object arg,
                                       java.lang.Object arg2)
Call a method in the visitor depending on the type. This method is the entry point for the visitor pattern.

Parameters:
visitor - the visitor to call
arg - an arbitrary argument passed to the visitor
arg2 - an arbitrary second argument passed to the visitor
Returns:
an arbitrary return value