de.dante.extex.interpreter.interaction
Class Interaction

java.lang.Object
  extended byde.dante.extex.interpreter.interaction.Interaction
All Implemented Interfaces:
java.io.Serializable

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

This class provides a type-save enumeration of the interactions styles of ExTeX. It provides constants for the supported interaction modes. In addition it supports the visitor pattern to react on them.

Version:
$Revision: 1.4 $
Author:
Gerd Neugebauer
See Also:
"TeX – The Program [73]", Serialized Form

Field Summary
static Interaction BATCHMODE
          The constant BATCHMODE contains the constant for batch mode.
static Interaction ERRORSTOPMODE
          The constant ERRORSTOPMODE contains the constant for error stop mode.
static Interaction NONSTOPMODE
          The constant NONSTOPMODE contains the constant for non-stop mode.
static Interaction SCROLLMODE
          The constant SCROLLMODE contains the constant for scroll mode.
 
Constructor Summary
protected Interaction()
          Creates a new object.
 
Method Summary
static Interaction get(int mode)
          This is a factory method for interaction modes.
static int get(Interaction mode)
          Find the integer number corresponding to an interaction
static Interaction get(java.lang.String mode)
          This is a factory method for interaction modes.
abstract  java.lang.String getIndex()
          Get the numeric index of the interaction mode.
abstract  boolean visit(InteractionVisitor visitor, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          This method provides an entry point for the visitor pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BATCHMODE

public static final Interaction BATCHMODE
The constant BATCHMODE contains the constant for batch mode.


ERRORSTOPMODE

public static final Interaction ERRORSTOPMODE
The constant ERRORSTOPMODE contains the constant for error stop mode.


NONSTOPMODE

public static final Interaction NONSTOPMODE
The constant NONSTOPMODE contains the constant for non-stop mode.


SCROLLMODE

public static final Interaction SCROLLMODE
The constant SCROLLMODE contains the constant for scroll mode.

Constructor Detail

Interaction

protected Interaction()
Creates a new object. This constructor is private to avoid that other interaction modes than the predefined ones are used.

Method Detail

get

public static Interaction get(int mode)
                       throws InteractionUnknownException
This is a factory method for interaction modes. It mapps numerical values to interaction mode instances. The instances are reused and may be compared with ==.

Parameters:
mode - the integer value for the interaction mode
Returns:
the appropriate interaction mode constant
Throws:
InteractionUnknownException - in case that the numerical value is out of range

get

public static int get(Interaction mode)
               throws InteractionUnknownException
Find the integer number corresponding to an interaction

Parameters:
mode - the mode to identify
Returns:
the number of the mode
Throws:
InteractionUnknownException - in case of an error

get

public static Interaction get(java.lang.String mode)
                       throws InteractionUnknownException
This is a factory method for interaction modes. It maps numerical values to interaction mode instances. The instances are reused and may be compared with ==. Allowed values are the numbers 0 to 3 or the symbolic names batchmode (0), nonstopmode (1), scrollmode (2), and errorstopmode (3). The symbolic names can be abbreviated up to the least unique prefix, i.e. up to one character.

Parameters:
mode - the string representation for the mode
Returns:
the appropriate interaction mode constant
Throws:
InteractionUnknownException - in case that something is passed in which can not be interpreted as interaction mode

getIndex

public abstract java.lang.String getIndex()
Get the numeric index of the interaction mode. According to the definition os TeX the following mapping holds:
BatchMode0
NonstopMode1
ScrollMode2
ErrorstopMode3

Returns:
the numeric index

visit

public abstract boolean visit(InteractionVisitor visitor,
                              java.lang.Object arg1,
                              java.lang.Object arg2,
                              java.lang.Object arg3)
                       throws GeneralException
This method provides an entry point for the visitor pattern.

Parameters:
visitor - this argument contains the visitor which has initiated the request.
arg1 - the first argument
arg2 - the second argument
arg3 - the third argument
Returns:
a boolean indicator
Throws:
GeneralException - in case of an error
See Also:
InteractionVisitor