|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.interpreter.max.context.ContextImpl
public class ContextImpl
This is a reference implementation for an interpreter context.
The groups are implemented as a linked list of single groups. In contrast to
the Knuthian implementation in
Several operations have to be dealt with:
Group is created with the old
one as next group.
| Field Summary | |
|---|---|
protected static long |
serialVersionUID
The constant serialVersionUID contains the id for serialization. |
| Constructor Summary | |
|---|---|
ContextImpl()
Creates a new object. |
|
| Method Summary | |
|---|---|
void |
addUnit(UnitInfo info)
Add a unit to the list of loaded units. |
void |
afterGroup(AfterGroupObserver observer)
Register a observer to be called at the end of the group. |
void |
afterGroup(Token t)
Add a token to the tokens inserted after the group has been closed. |
void |
clearSplitMarks()
This method clears all split marks. |
void |
closeGroup(Typesetter typesetter,
TokenSource source)
Perform all actions required upon the closing of a group. |
void |
configure(Configuration configuration)
Configure an object according to a given Configuration. |
void |
enableLogging(java.util.logging.Logger logger)
Setter for the logger. |
java.lang.String |
esc(java.lang.String name)
Attach the current escape character in front of a name and return the result. |
java.lang.String |
esc(Token token)
This method is meant to produce a printable version of a control sequence for error messages. |
UnicodeChar |
escapechar()
Return the current escape character or \0 |
java.lang.Object |
get(java.lang.Object extension,
java.lang.Object key)
Getter for a value from an extended section of the context. |
Token |
getAfterassignment()
Getter for the after assignment token. |
Tokens |
getBottomMark(java.lang.Object name)
Getter for the bottom mark. |
Box |
getBox(java.lang.String name)
Getter for the box register. |
Catcode |
getCatcode(UnicodeChar uc)
Get the Catcode for a given Unicode character. |
Code |
getCode(CodeToken t)
Convenience method to get the code assigned to a Token. |
Conditional |
getConditional()
Getter for the currently active conditional. |
Count |
getCount(java.lang.String name)
Getter for the count register. |
FixedCount |
getCountOption(java.lang.String name)
Getter for a count register. |
MathDelimiter |
getDelcode(UnicodeChar c)
Getter for the delimiter code mapping. |
Dimen |
getDimen(java.lang.String name)
Get the current value of the dimen register with a given name. |
FixedDimen |
getDimenOption(java.lang.String name)
Getter for a dimen register. |
int |
getErrorCount()
Getter for the error count. |
Tokens |
getFirstMark(java.lang.Object name)
Getter for the first mark. |
Font |
getFont(java.lang.String name)
Getter for a current font register. |
CoreFontFactory |
getFontFactory()
Getter for the font factory. |
Glue |
getGlue(java.lang.String name)
Getter for a glue register. |
FixedGlue |
getGlueOption(java.lang.String name)
Getter for a glue register. |
protected Group |
getGroup()
Getter for group. |
GroupInfo[] |
getGroupInfos()
Getter for the array of group information describing the currently open groups. |
long |
getGroupLevel()
Getter for the group level. |
GroupType |
getGroupType()
Getter for the group type. |
java.lang.String |
getId()
Getter for the id string. |
long |
getIfLevel()
Getter for the current if level. |
InFile |
getInFile(java.lang.String name)
Getter for a input file register. |
Interaction |
getInteraction()
Getter for the interaction. |
Language |
getLanguage(java.lang.String language)
Getter for the hyphenation record for a given language. |
LanguageManager |
getLanguageManager()
Getter for the language manager. |
UnicodeChar |
getLccode(UnicodeChar uc)
Getter for the lccode mapping of upper case characters to their lower case equivalent. |
protected Localizer |
getLocalizer()
Getter for localizer. |
long |
getMagnification()
Getter for the magnification factor in per mille. |
MathCode |
getMathcode(UnicodeChar uc)
Getter for the math code of a character. |
Muskip |
getMuskip(java.lang.String name)
Getter for a muskip register. |
java.lang.String |
getNamespace()
Getter for the current name space. |
OutFile |
getOutFile(java.lang.String name)
Getter for an output file descriptor. |
ParagraphShape |
getParshape()
Getter for the parshape. |
FixedCount |
getSfcode(UnicodeChar uc)
Getter for the space factor code of a character. |
Tokens |
getSplitBottomMark(java.lang.Object name)
Getter for the split bottom mark. |
Tokens |
getSplitFirstMark(java.lang.Object name)
Getter for the split first mark. |
TokenStream |
getStandardTokenStream()
Getter for standardTokenStream. |
TokenFactory |
getTokenFactory()
Getter for the token factory. |
Tokenizer |
getTokenizer()
Getter for the tokenizer. |
java.lang.String |
getTokensOption(java.lang.String name)
Getter for a token register. |
Tokens |
getToks(java.lang.String name)
Getter for the Tokens
register. |
FixedTokens |
getToksOption(java.lang.String name)
Getter for a tokens register. |
Tokens |
getToksOrNull(java.lang.String name)
Getter for the toks
register. |
Tokens |
getTopMark(java.lang.Object name)
Getter for the top mark. |
TypesettingContext |
getTypesettingContext()
Getter for the typesetting context. |
TypesettingContextFactory |
getTypesettingContextFactory()
Getter for the typesetting context factory. |
UnicodeChar |
getUccode(UnicodeChar lc)
Getter for the uccode mapping of lower case characters to their upper case equivalent. |
int |
incrementErrorCount()
Increment the error count by 1. |
boolean |
isGlobalGroup()
Test whether this group is the first one, which means that there is no group before and closing this group would fail. |
void |
openGroup(GroupType type,
Locator locator,
Token start)
This method can be used to open another group. |
Conditional |
popConditional()
Pop the management information for a conditional from the stack and return it. |
Direction |
popDirection()
Pop a direction from the direction stack. |
void |
pushConditional(Locator locator,
boolean isIfThenElse,
Code primitive,
long branch,
boolean neg)
Put a value onto the conditional stack. |
void |
pushDirection(Direction dir)
Push a direction onto the direction stack. |
java.lang.Object |
readResolve()
This method maps instances to their normal representations if required. |
void |
receiveLoad(TokenSource source,
Typesetter typesetter)
Receive a notification about a load event. |
void |
registerCodeChangeObserver(Token token,
CodeObserver observer)
Register an observer for code change events. |
void |
registerConditionalObserver(ConditionalObserver observer)
Register an observer for conditional events. |
void |
registerCountObserver(java.lang.String name,
CountObserver observer)
Register an observer for count change events. |
void |
registerDimenObserver(java.lang.String name,
DimenObserver observer)
Register an observer for dimen change events. |
void |
registerGlueObserver(java.lang.String name,
GlueObserver observer)
Register an observer for glue change events. |
void |
registerGroupObserver(GroupObserver observer)
Register an observer for group change events. |
void |
registerInteractionObserver(InteractionObserver observer)
Register an observer for interaction mode change events. |
void |
registerLoadObserver(LoadedObserver observer)
Register an observer for load events. |
void |
registerTokensObserver(java.lang.String name,
TokensObserver observer)
Register an observer for tokens change events. |
void |
set(Color color,
boolean global)
Setter for the color in the current typesetting context. |
void |
set(Direction direction,
boolean global)
Setter for the direction in the current typesetting context. |
void |
set(Font font,
boolean global)
Setter for the font in the current typesetting context. |
void |
set(Language language,
boolean global)
Setter for the language in the current typesetting context. |
void |
set(java.lang.Object extension,
java.lang.Object key,
java.lang.Object value,
boolean global)
Setter for a value from an extended section of the context. |
void |
set(TypesettingContext context,
boolean global)
Setter for the typesetting context in the specified groups. |
void |
setAfterassignment(Token token)
Setter for the after assignment token. |
void |
setBox(java.lang.String name,
Box value,
boolean global)
Setter for the box register in
the current group. |
void |
setCatcode(UnicodeChar c,
Catcode catcode,
boolean global)
Setter for the catcode of a character in the specified groups. |
void |
setCode(CodeToken t,
Code code,
boolean global)
Setter for the code assigned to a Token. |
void |
setCount(java.lang.String name,
long value,
boolean global)
Setter for the count register in all
requested groups. |
void |
setCountOption(java.lang.String name,
long value)
Setter for a count register. |
void |
setDelcode(UnicodeChar c,
MathDelimiter delimiter,
boolean global)
Setter for the delimiter code mapping. |
void |
setDimen(java.lang.String name,
Dimen value,
boolean global)
Setter for the Dimen register in all
requested groups. |
void |
setDimen(java.lang.String name,
long value,
boolean global)
Setter for the Dimen register in all
requested groups. |
void |
setFont(java.lang.String name,
Font font,
boolean global)
Setter for font registers. |
void |
setFontFactory(CoreFontFactory factory)
Setter for the font factory. |
void |
setGlue(java.lang.String name,
Glue value,
boolean global)
Setter for a glue register. |
void |
setId(java.lang.String theId)
Setter for the id string. |
void |
setInFile(java.lang.String name,
InFile file,
boolean global)
Setter for the InFile register
in all requested groups. |
void |
setInteraction(Interaction interaction)
Setter for the interaction in all requested groups. |
void |
setLanguageManager(LanguageManager manager)
Setter for the language manager. |
void |
setLccode(UnicodeChar uc,
UnicodeChar lc,
boolean global)
Declare the translation from an upper case character to a lower case character. |
void |
setMagnification(long mag,
boolean lock)
Setter for the magnification. |
void |
setMark(java.lang.Object name,
Tokens mark)
Setter for a mark. |
void |
setMathcode(UnicodeChar uc,
MathCode code,
boolean global)
Setter for the math code of a character |
void |
setMuskip(java.lang.String name,
Muskip value,
boolean global)
Setter for a muskip register. |
void |
setNamespace(java.lang.String namespace,
boolean global)
Setter for the name space. |
void |
setOutFile(java.lang.String name,
OutFile file,
boolean global)
Setter for a output file descriptor. |
void |
setParshape(ParagraphShape shape)
Setter for the paragraph shape. |
void |
setSfcode(UnicodeChar uc,
Count code,
boolean global)
Setter for the space factor code in the specified groups. |
void |
setSplitMark(java.lang.Object name,
Tokens mark)
Setter for a split mark. |
void |
setStandardTokenStream(TokenStream standardTokenStream)
Setter for standardTokenStream. |
void |
setTokenFactory(TokenFactory factory)
Setter for the token factory |
void |
setToks(java.lang.String name,
Tokens toks,
boolean global)
Setter for the Tokens
register in the specified groups. |
void |
setUccode(UnicodeChar lc,
UnicodeChar uc,
boolean global)
Declare the translation from a lower case character to an upper case character. |
void |
startMarks()
This method indicated that a new page is started. |
java.util.Iterator<UnitInfo> |
unitIterator()
Get an iterator to enumerate all unit infos. |
void |
unregisterCodeChangeObserver(Token name,
CodeObserver observer)
Remove a registered observer for code change events. |
void |
unregisterConditionalObserver(ConditionalObserver observer)
Remove a registered observer for conditional events. |
void |
unregisterCountObserver(java.lang.String name,
CountObserver observer)
Remove a registered observer for count change events. |
void |
unregisterDimenObserver(java.lang.String name,
DimenObserver observer)
Remove a registered observer for dimen change events. |
void |
unregisterGlueObserver(java.lang.String name,
GlueObserver observer)
Remove a registered observer for glue change events. |
void |
unregisterGroupObserver(GroupObserver observer)
Remove a registered observer for group change events. |
void |
unregisterInteractionObserver(InteractionObserver observer)
Remove a registered observer for interaction mode change events. |
void |
unregisterLoadObserver(LoadedObserver observer)
Remove a registered observer for load events. |
void |
unregisterTokensChangeObserver(java.lang.String name,
TokensObserver observer)
Remove a registered observer for tokens change events. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final long serialVersionUID
| Constructor Detail |
|---|
public ContextImpl()
| Method Detail |
|---|
public void addUnit(UnitInfo info)
addUnit in interface Contextinfo - the info of the unit loadedunitIterator(),
Context.addUnit(
org.extex.interpreter.unit.UnitInfo)public void afterGroup(AfterGroupObserver observer)
afterGroup in interface ContextGroupobserver - the observer to registerContextGroup.afterGroup(
AfterGroupObserver)public void afterGroup(Token t)
afterGroup in interface ContextGroupt - the token to addContextGroup.afterGroup(
org.extex.scanner.type.token.Token)public void clearSplitMarks()
clearSplitMarks in interface ContextMarkContextMark.clearSplitMarks()
public void closeGroup(Typesetter typesetter,
TokenSource source)
throws HelpingException
closeGroup in interface ContextGrouptypesetter - the typesetter to invoke if neededsource - the source to get Tokens from if needed
HelpingException - in case of an errorContextGroup.closeGroup(
org.extex.typesetter.Typesetter, org.extex.interpreter.TokenSource)public void configure(Configuration configuration)
configure in interface Configurableconfiguration - the configuration object to consider
ConfigurationException - in case that something went wrongConfigurable.configure(
org.extex.framework.configuration.Configuration)public void enableLogging(java.util.logging.Logger logger)
enableLogging in interface LogEnabledlogger - the logger to useLogEnabled.enableLogging(
java.util.logging.Logger)public java.lang.String esc(java.lang.String name)
This method is meant to produce a printable version of a control sequence for error messages.
esc in interface Contextname - the name of the macro
Context.esc(java.lang.String)public java.lang.String esc(Token token)
esc in interface Contexttoken - the token
Context.esc(
org.extex.scanner.type.token.Token)public UnicodeChar escapechar()
\0 if it is undefined.
The escape character is retrieved from the count register
\escapechar.
- Specified by:
escapechar in interface Context
- Returns:
- the escape character
- See Also:
Context.escapechar()
public java.lang.Object get(java.lang.Object extension,
java.lang.Object key)
Context
get in interface Contextextension - the name of the extensionkey - the key for the value
Context.get( java.lang.Object,
java.lang.Object)public Token getAfterassignment()
getAfterassignment in interface ContextContext.getAfterassignment()public Tokens getBottomMark(java.lang.Object name)
getBottomMark in interface ContextMarkname - the name of the mark
ContextMark.getBottomMark(
java.lang.Object)public Box getBox(java.lang.String name)
box register.
Count registers are named, either with a number or an arbitrary string.
getBox in interface Contextname - the name or number of the count register
null if it is voidContext.getBox(java.lang.String)public Catcode getCatcode(UnicodeChar uc)
Catcode for a given Unicode character.
getCatcode in interface Tokenizeruc - the Unicode character to get the catcode for.
Tokenizer.getCatcode(org.extex.core.UnicodeChar)
public Code getCode(CodeToken t)
throws HelpingException
getCode in interface ContextCodet - the Token to differentiate on
HelpingException - in case of an errorContextCode.getCode(
org.extex.scanner.type.token.CodeToken)public Conditional getConditional()
getConditional in interface Contextnull if noneContext.getConditional()public Count getCount(java.lang.String name)
count register. Count
registers are named, either with a number or an arbitrary string.
The return value is guaranteed to be a valid object. null
will never be returned.
getCount in interface ContextCountname - the name or number of the count register
null if it is not definedContextCount.getCount( java.lang.String)public FixedCount getCountOption(java.lang.String name)
getCountOption in interface DocumentWriterOptionsgetCountOption in interface TokenStreamOptionsgetCountOption in interface PageContextgetCountOption in interface TypesetterOptionsname - the name of the register
TypesetterOptions.getCountOption(
java.lang.String)public MathDelimiter getDelcode(UnicodeChar c)
getDelcode in interface Contextc - the character to which the delimiter code is assigned
Context.getDelcode(
org.extex.core.UnicodeChar)public Dimen getDimen(java.lang.String name)
getDimen in interface ContextDimenname - the name or the number of the register
ContextDimen.getDimen( java.lang.String)public FixedDimen getDimenOption(java.lang.String name)
getDimenOption in interface DocumentWriterOptionsgetDimenOption in interface PageContextgetDimenOption in interface TypesetterOptionsname - the name of the register
TypesetterOptions.getDimenOption(
java.lang.String)public int getErrorCount()
ContextErrorCount
getErrorCount in interface ContextErrorCountContextErrorCount.getErrorCount()public Tokens getFirstMark(java.lang.Object name)
ContextMark
getFirstMark in interface ContextMarkname - the name of the mark
ContextMark.getFirstMark(
java.lang.Object)public Font getFont(java.lang.String name)
ContextFont
getFont in interface ContextFontgetFont in interface PageContextgetFont in interface TypesetterOptionsname - the name or the number of the register
null if none is setContextFont.getFont(java.lang.String)public CoreFontFactory getFontFactory()
ContextFont
getFontFactory in interface ContextFontContextFont.getFontFactory()public Glue getGlue(java.lang.String name)
Context
getGlue in interface Contextname - the name of the glue register to acquire.
null if
none is setContext.getGlue(java.lang.String)public FixedGlue getGlueOption(java.lang.String name)
PageContext
getGlueOption in interface PageContextgetGlueOption in interface TypesetterOptionsname - the name of the register
TypesetterOptions.getGlueOption(java.lang.String)protected Group getGroup()
public GroupInfo[] getGroupInfos()
getGroupInfos in interface ContextGroupContextGroup.getGroupInfos()public long getGroupLevel()
getGroupLevel in interface ContextGroupContextGroup.getGroupLevel()public GroupType getGroupType()
getGroupType in interface ContextGroupContextGroup.getGroupType()public java.lang.String getId()
null if not known yet.
getId in interface ContextContext.getId()public long getIfLevel()
getIfLevel in interface ContextContext.getIfLevel()public InFile getInFile(java.lang.String name)
null then the default input stream is used.
getInF