de.dante.extex.interpreter.type
Class AbstractCode

java.lang.Object
  extended byde.dante.extex.interpreter.type.AbstractCode
All Implemented Interfaces:
Code, Localizable, java.io.Serializable
Direct Known Subclasses:
AbstractAlign, AbstractAssignment, AbstractBox, AbstractBoxPrimitive, AbstractDirCode, AbstractFileCode, AbstractHorizontalCode, AbstractHyphenationCode, AbstractIf, AbstractMarkCode, AbstractMarksCode, AbstractMath, AbstractMathCode, AbstractModeCode, AbstractPdftexCode, AbstractReadonlyCount, AbstractVerticalCode, Accent, Addafterocplist, Addbeforeocplist, Afterassignment, Aftergroup, Badness, Begingroup, BeginL, BeginR, BoxParameter, Char, CharCode, Cleaders, Clearocplists, Closein, Closeout, Cr, Csname, Currentgrouplevel, Currentgrouptype, Currentifbranch, Currentiflevel, Currentiftype, Detokenize, Dimenexpr, Discretionary, Dump, Efcode, Else, End, Endcsname, Endgroup, Endinput, EndL, EndR, EnsureLoaded, Errmessage, Expandafter, Fi, Fontchardp, Fontcharht, Fontcharic, Fontcharwd, FontCode, Fontname, Global, Glueexpr, Glueshrink, Glueshrinkorder, Gluestretch, Gluestretchorder, Gluetomu, Hrule, Hyphen, Ignorespaces, Immediate, Inputfilename, Inputlineno, ItalicCorrection, JavaLoad, Jobname, Kern, Lastbox, Lastkern, Lastpenalty, Leaders, Localleftbox, Localrightbox, Long, Lowercase, MacroCode, Message, Muexpr, Mutoglue, NativeLoad, Naturaldir, Noalign, Noexpand, NullfontPrimitive, Nullocplist, Number, Numexpr, OcplistPrimitive, Oglueshrinkorder, Ogluestretchorder, Omit, Or, Outer, OutputTranslation, Par, Parshape, Parshapedimen, Parshapeindent, Parshapelength, Penalty, Popocplist, PrintFormat, Protected, Pushocplist, Relax, Removeafterocplist, Removebeforeocplist, Romannumeral, Scantokens, Shipout, Show, Showprefix, Showthe, Showtokens, Space, Spacefactor, Span, Special, StringPrimitive, The, Unexpanded, Unkern, Unless, Unnaturaldir, Unpenalty, Unskip, Uppercase, Vrule, Write, Xleaders

public abstract class AbstractCode
extends java.lang.Object
implements Code, Localizable, java.io.Serializable

This is the abstract base class which can be used for all classes implementing the interface Code. It provides some useful definitions for most of the methods.

Version:
$Revision: 1.24 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
 
Constructor Summary
AbstractCode(java.lang.String codeName)
          Creates a new object.
 
Method Summary
 void enableLocalization(Localizer theLocalizer)
          Setter for the localizer.
 void execute(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          This method takes the first token and executes it.
protected  Localizer getLocalizer()
          Getter for localizer.
 java.lang.String getName()
          Getter for the name.
 boolean isIf()
          This simple little method distinguishes the conditionals from the other primitives.
 boolean isOuter()
          Getter for the outer flag.
static java.lang.String printable(Context context, Token token)
          Return the printable version of a token for error messages.
protected  java.lang.String printableControlSequence(Context context)
          Attach the current escape character in front of the name and return the result.
protected  java.lang.Object readResolve()
          Restore the internal state when the instance is loaded from file.
 void setName(java.lang.String theName)
          Setter for the name of this primitive.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

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

See Also:
Constant Field Values
Constructor Detail

AbstractCode

public AbstractCode(java.lang.String codeName)
Creates a new object.

Parameters:
codeName - the name of the primitive
Method Detail

printable

public static java.lang.String printable(Context context,
                                         Token token)
Return the printable version of a token for error messages.

Parameters:
context - the processing context
token - the token to get a printable representation for
Returns:
the control sequence including the escape character

enableLocalization

public void enableLocalization(Localizer theLocalizer)
Setter for the localizer.

Specified by:
enableLocalization in interface Localizable
Parameters:
theLocalizer - the new value for the localizer
See Also:
Localizable.enableLocalization( de.dante.util.framework.i18n.Localizer)

execute

public void execute(Flags prefix,
                    Context context,
                    TokenSource source,
                    Typesetter typesetter)
             throws InterpreterException
Description copied from interface: Code
This method takes the first token and executes it. The result is placed on the stack. This operation might have side effects. To execute a token it might be necessary to consume further tokens.

Specified by:
execute in interface Code
Parameters:
prefix - the prefix controlling the execution
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
InterpreterException - in case of an error
See Also:
Code.execute( de.dante.extex.interpreter.Flags, de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)

getLocalizer

protected Localizer getLocalizer()
Getter for localizer.

Returns:
the localizer.

getName

public java.lang.String getName()
Description copied from interface: Code
Getter for the name.

Specified by:
getName in interface Code
Returns:
the name
See Also:
Code.getName()

isIf

public boolean isIf()
Description copied from interface: Code
This simple little method distinguishes the conditionals from the other primitives. This is necessary for the processing of all \if* primitives.

Specified by:
isIf in interface Code
Returns:
true iff this is some sort if \if.
See Also:
Code.isIf()

isOuter

public boolean isOuter()
Description copied from interface: Code
Getter for the outer flag.

Specified by:
isOuter in interface Code
Returns:
true iff the code is defined outer.
See Also:
Code.isOuter()

printableControlSequence

protected java.lang.String printableControlSequence(Context context)
Attach the current escape character in front of the name and return the result.

This method is meant to produce a printable version of the control sequence for error messages.

Parameters:
context - the processing context
Returns:
the control sequence including the escape character

readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Restore the internal state when the instance is loaded from file.

Returns:
the object which should be used instead of the one read
Throws:
java.io.ObjectStreamException - in case of an error

setName

public void setName(java.lang.String theName)
Description copied from interface: Code
Setter for the name of this primitive.

Specified by:
setName in interface Code
Parameters:
theName - the name
See Also:
Code.setName(java.lang.String)

toString

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