|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.interpreter.type.AbstractCode
org.extex.unit.base.conditional.AbstractIf
public abstract class AbstractIf
This is the abstract base class for all ifs.
If you want to implement an if-like primitive you should derive it from this
class. All you have to do is to implement the method
conditional().
Here you define the expression evaluated to determine whether the if or the
else branch should be taken.
| Field Summary | |
|---|---|
protected static long |
serialVersionUID
The constant serialVersionUID contains the id for serialization. |
| Constructor Summary | |
|---|---|
AbstractIf(CodeToken token)
Creates a new object. |
|
| Method Summary | |
|---|---|
abstract boolean |
conditional(Context context,
TokenSource source,
Typesetter typesetter)
This method computes the boolean value of the conditional. |
void |
execute(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
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. |
void |
expand(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
This method takes the first token and expands it. |
protected static Localizer |
getMyLocalizer()
Getter for the localizer. |
boolean |
isIf()
The ifs are characterized by the return value true of this
method. |
static boolean |
skipToElseOrFi(Context context,
TokenSource source,
CodeToken primitive)
Skip to the next matching \fi or \else Token counting the intermediate \ifs and \fis. |
| Methods inherited from class org.extex.interpreter.type.AbstractCode |
|---|
getLocalizer, getName, getToken, isOuter, readResolve, toString, toText, toText |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final long serialVersionUID
| Constructor Detail |
|---|
public AbstractIf(CodeToken token)
token - the initial token for the primitive| Method Detail |
|---|
protected static Localizer getMyLocalizer()
public static boolean skipToElseOrFi(Context context,
TokenSource source,
CodeToken primitive)
throws HelpingException
This method implements the absorption of tokens at high speed.
context - the interpreter contextsource - the source for new tokensprimitive - the name of the invoking primitive
true if a matching \else has been
found; otherwise return false if a matching
\fi has been found
HelpingException - in case of en error
public abstract boolean conditional(Context context,
TokenSource source,
Typesetter typesetter)
throws HelpingException,
TypesetterException
true then the then branch is expanded and the else
branch is skipped. Otherwise the then branch is skipped and the else
branch is expanded.
context - the interpreter contextsource - the source for new tokenstypesetter - the typesetter
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
ConfigurationException - in case of an configuration error
public void execute(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
throws HelpingException,
TypesetterException
execute in interface Codeexecute in class AbstractCodeprefix - the prefix controlling the executioncontext - the interpreter contextsource - the token sourcetypesetter - the typesetter
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetterAbstractCode.execute(
org.extex.interpreter.Flags, org.extex.interpreter.context.Context,
org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)
public void expand(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
throws HelpingException,
TypesetterException
expand in interface ExpandableCodeprefix - the prefix flags controlling the expansioncontext - the interpreter contextsource - the token sourcetypesetter - the typesetter
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetterExpandableCode.expand(
org.extex.interpreter.Flags, org.extex.interpreter.context.Context,
org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)public boolean isIf()
true of this
method. Thus the overwritten method returning the constant is provided in
this abstract base class.
isIf in interface CodeisIf in class AbstractCodetrue iff this is some sort if \if.Code.isIf()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||