org.extex.interpreter.primitives.register.pair
Class NamedPair

java.lang.Object
  extended by org.extex.interpreter.type.AbstractCode
      extended by org.extex.interpreter.type.AbstractAssignment
          extended by org.extex.interpreter.primitives.register.pair.NamedPair
All Implemented Interfaces:
java.io.Serializable, PairConvertible, Code, Theable
Direct Known Subclasses:
NumberedPair

public class NamedPair
extends AbstractAssignment
implements Theable, PairConvertible

This class provides an implementation for the pair valued primitives. It sets the named pair register to the value given, and as a side effect all prefixes are zeroed.

Example generic viagra canadian

 \xy=1.234 3.45
 

Version:
$Revision: 6447 $
Author:
Michael Niedermair
See Also:
Serialized Form

Constructor Summary
NamedPair(CodeToken token, java.lang.String key)
          Creates a new object.
 
Method Summary
 void assign(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          The method assign is the core of the functionality of execute().
 Pair convertPair(Context context, TokenSource source, Typesetter typesetter)
          Convert to a pair.
protected  java.lang.String getKey(Context context, TokenSource source, Typesetter typesetter)
          Return the key (the name of the primitive) for the register.
 void set(Context context, Pair value)
          set the value
 void set(Context context, java.lang.String value)
          Set the value
 Tokens the(Context context, TokenSource source, Typesetter typesetter)
          This method is the getter for the description of the primitive.
 
Methods inherited from class org.extex.interpreter.type.AbstractAssignment
execute
 
Methods inherited from class org.extex.interpreter.type.AbstractCode
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamedPair

public NamedPair(CodeToken token,
                 java.lang.String key)
Creates a new object.

Parameters:
token - the initial token for the primitive
key - the reference key
Method Detail

assign

public void assign(Flags prefix,
                   Context context,
                   TokenSource source,
                   Typesetter typesetter)
            throws ConfigurationException,
                   HelpingException,
                   TypesetterException
Description copied from class: AbstractAssignment
The method assign is the core of the functionality of execute(). This method is preferable to execute() since the execute() method provided in this class takes care of \afterassignment and \globaldefs as well.

Specified by:
assign in class AbstractAssignment
Parameters:
prefix - the prefix controlling the execution
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
ConfigurationException - in case of an configuration error
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
AbstractAssignment.assign( org.extex.interpreter.Flags, org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)

set

public void set(Context context,
                Pair value)
         throws HelpingException
set the value

Parameters:
context - the interpreter context
value - the new value
Throws:
HelpingException - if no extension is configured.

set

public void set(Context context,
                java.lang.String value)
         throws HelpingException
Set the value

Parameters:
context - the interpreter context
value - the new value as String
Throws:
HelpingException - if no extension is configured

the

public Tokens the(Context context,
                  TokenSource source,
                  Typesetter typesetter)
           throws CatcodeException,
                  HelpingException,
                  TypesetterException
This method is the getter for the description of the primitive.

Specified by:
the in interface Theable
Parameters:
context - the interpreter context
source - the source for further tokens to qualify the request
typesetter - the typesetter to use
Returns:
the description of the primitive as list of Tokens
Throws:
CatcodeException - in case of an error in token creation
ConfigurationException - in case of an configuration error
HelpingException - in case of an error
TypesetterException - in case of an error
See Also:
Theable.the( org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)

getKey

protected java.lang.String getKey(Context context,
                                  TokenSource source,
                                  Typesetter typesetter)
                           throws HelpingException,
                                  TypesetterException
Return the key (the name of the primitive) for the register.

Parameters:
context - the context
source - the source
typesetter - the typesetter
Returns:
the key
Throws:
HelpingException - in case of an error.
TypesetterException - in case of an error in the typesetter

convertPair

public Pair convertPair(Context context,
                        TokenSource source,
                        Typesetter typesetter)
                 throws HelpingException,
                        TypesetterException
Convert to a pair.

Specified by:
convertPair in interface PairConvertible
Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
Returns:
the converted value
Throws:
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetter
See Also:
PairConvertible.convertPair( org.extex.interpreter.context.Context, org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)