Follow the links below to browse sample Javadoc for MJ classes and tools, including the MJ Runtime Library.

 

Package: com.arsi.mj.maprpt.lexer  previous next contents

Package com.arsi.mj.maprpt.lexer contains the following classes and interfaces.
Classes and Interfaces
CommandLexerState
IgnoreRunLineDecorator Implements the decorator pattern to process Mapper report lines with a mind to ignore lines in a Mapper RUN control report.
MaprptLexer
MaprptReferenceResolver Resolves references to Mapper reports using previously discovered Mapper artifacts.
MaprptTokenReplacer Replaces alphanumeric tokens in a line of content with token stored in a token replacement context, i.e., handles the substitution of :DEFINEd constants in a text line.
TokenReplacementContext Context that is developed during lexical analysis of Mapper run control report to store DEFINE constants and their replacement strings.

Class: CommandLexerState   next package

public class com.arsi.mj.maprpt.lexer.CommandLexerState
  extends java.lang.Object

Class: IgnoreRunLineDecorator   previous next package

Implements the decorator pattern to process Mapper report lines with a mind to ignore lines in a Mapper RUN control report.
Treat this class as "thread-hostile", since it is intended to be created, used and discarded by a single thread.
public class com.arsi.mj.maprpt.lexer.IgnoreRunLineDecorator
  extends com.arsi.mj.maprpt.parser.lineproc.LineProcessorBase
Constructors
Public ctor for initializing an instance of this class.
Parameters:
aPragma - ignore RUN line pragma.
public IgnoreRunLineDecorator(com.arsi.mj.maprpt.parser.pragma.types.IgnoreRunLinePragma aPragma)
Methods
public boolean applyActions(com.arsi.mj.maprpt.parser.line.types.MaprptLine aMaprptLine)
Should line that was last fed to LineProcessorBase.applyActions() be ignored?
Returns:
true if last line is to be ignored, false if not.
public boolean ignoreProcessedLine()
public boolean wantLine(com.arsi.mj.maprpt.parser.line.types.MaprptLine aMaprptLine)

Class: MaprptLexer   previous next package

public class com.arsi.mj.maprpt.lexer.MaprptLexer
  extends java.lang.Object
Inner Interface IgnoreRunLineCallback
Callback to invoke for lines ignored via ignore-run-line pragma.
public static interface com.arsi.mj.maprpt.lexer.MaprptLexer.IgnoreRunLineCallback
Reports line that was ignored because of ignore-run-line pragma or forceIgnoreOfNextLine method.
Parameters:
aLine - 
public void ignoredLine(com.arsi.mj.maprpt.parser.line.types.MaprptLine aLine)
Inner Class IgnoreRunLineFilter
Filter that handles processing of the ignore-run-line pragma, including optional callback.
public class com.arsi.mj.maprpt.lexer.MaprptLexer.IgnoreRunLineFilter
  extends java.lang.Object
  implements com.arsi.mj.maprpt.lexer.MaprptLexer.LineFilter
public boolean accept(com.arsi.mj.maprpt.parser.line.types.MaprptLine aLine)
Inner Class IncludeTargetFilter
Filter that exclude all but colon lines containing a DEFINE when lexer is parsing a "target" report referenced by an INCLUDE statement in another Mapper report.
public class com.arsi.mj.maprpt.lexer.MaprptLexer.IncludeTargetFilter
  extends java.lang.Object
  implements com.arsi.mj.maprpt.lexer.MaprptLexer.LineFilter
public MaprptLexer.IncludeTargetFilter()
public boolean accept(com.arsi.mj.maprpt.parser.line.types.MaprptLine aLine)
Inner Interface LineFilter
Defines filter to control which lines in the Mapper report are parsed and processed by the lexer.
public static interface com.arsi.mj.maprpt.lexer.MaprptLexer.LineFilter
Determine if Mapper report line is acceptable to lexer.
Parameters:
aLine - a Mapper report line.
Returns:
true to accept the line for parsing and processing by the lexer, false to ignore line.
public boolean accept(com.arsi.mj.maprpt.parser.line.types.MaprptLine aLine)
Constructors
Initializes an instance of this class.
Parameters:
aParseUnit - result of previous parse of Mapper report.
aDefaultTupleCharset - string of individual characters that should be treated as tab character when encountered as the first character in a line, i.e., identifies lines containing columnar data that start with a character other than a tab. Do not arbitrarily specify characters here, e.g., if the Mapper report lines contains in-line, non-tabular data in period or asterisk lines, do not specify . or * here. Can be NULL if no character other than tab identifies a line that contains columnar data.
aDefaultInlineCharset - set of default characters to match against first character of line that should be treated as in-line data (e.g., asterisk, period).
aDefaultInlineBeanref - default in-line data handler as bean reference name.
aCabinetNumber - number of cabinet of Mapper report.
aDrawerLetter - letter of drawer of Mapper report.
aReportNumber - number of Mapper report.
public MaprptLexer(com.arsi.mj.maprpt.parser.MaprptParseUnit aParseUnit, java.lang.String aDefaultTupleCharset, java.lang.String aDefaultInlineCharset, java.lang.String aDefaultInlineBeanref, int aCabinetNumber, char aDrawerLetter, int aReportNumber)
Methods
Add filter that can intercept and reject Mapper report line before the line is processed by the lexer during getToken.
Parameters:
aFilter - line filter to add.
public void addLineFilter(com.arsi.mj.maprpt.lexer.MaprptLexer.LineFilter aFilter)
Add resolver to handle references to Mapper reports encountered by lexer during getToken.
Parameters:
aResolver - Mapper report reference resolver to add.
public void addMaprptRefResolver(com.arsi.mj.maprpt.lexer.MaprptReferenceResolver aResolver)
Get number of cabinet of Mapper report being parsed.
public final int cabinetNumber()
Get letter of drawer of Mapper report being parsed.
public final char drawerLetter()
Force the next Mapper report line read by the lexer to be ignored. This is a one-shot setting that must be set again before the next line is parsed.
Parameters:
aCallback - required callback that is invoked to report the ignore line.
public void forceIgnoreOfNextLine(com.arsi.mj.maprpt.lexer.MaprptLexer.IgnoreRunLineCallback aCallback)
Get the characters remaining in the input buffer for this at-sign line after the last command token parsed. The characters in the buffer are raw input (no token replacement applied). Command tokens already parsed but pushed back are included in the buffer as text, but token replacement has occurred for such pushed-back text.
Returns:
copy of characters remaining in the raw input buffer (changes are not reflected in the input buffer), or NULL if none remaining.
public char getCopyOfRemainingRawInputBuffer()
Get number of nested calls from another lexer to this instance, i.e., as occurs with the :INCLUDE statement.
Returns:
number of nested calls, zero indicates no nested references to this lexer.
public final int getNestingLevel()
Perform lexical analysis to get next token from parse unit created from Mapper report.
Throws:
MJTranslateException - if an unexpected parsing error occurs.
Returns:
a token, which is either a content token (some kind of content other than a RUN command, e.g., text, column headings, data tuples) or a command token (the token is the smallest lexical unit that can can be parsed from a Mapper command on an at-sign line). NULL is returned when no more tokens are available in the parse unit.
public com.arsi.mj.maprpt.lexer.tokens.IMaprptToken getNextToken()
    throws com.arsi.mj.MJTranslateException
Get character that is the re-defined "quoted" string delimiter, if any.
Returns:
character that is the re-defined quoted string delimiter or null if quoted string delimiter was not re-defined.
public java.lang.Character getRedefinedQuotedStringDelimiter()
Get the characters remaining in the input buffer for this at-sign line after the last command token parsed, and advance to the next line. The characters in the buffer are raw input (no token replacement applied). Command tokens already parsed but pushed back are included in the buffer as text, but token replacement has occurred for such pushed-back text.
Returns:
characters remaining in the raw input buffer after the last command token parsed, and until the end of the current at-sign line, or NULL if none remaining.
public char getRemainingRawInputBufferAndAdvanceToNextLine()
Get starting line of label table (":L" lines) embedded in Mapper report, if any.
Returns:
line number of first line in label table, or -1 if none.
public final int getStartingLineOfLabelTable()
Get token replacement context that contains token replacements (token name and replacement value) extracted from :DEFINEs while parsing the Mapper report.
Returns:
token replacement context.
public final com.arsi.mj.maprpt.lexer.TokenReplacementContext getTokenReplacementContext()
Find all occurrences of column headings as column metadata in the parsed Mapper report lines as a prerequisite to lexical analysis of tokens.
public void initializeColumnMetadata()
Determine if specified command token the first token parsed from the at-sign line undergoing parsing.
Parameters:
aCmdToken - token to check as first parsed token.
Returns:
true if first token parsed from at-sign line, false if not.
public boolean isFirstCommandTokenParsedFromLine(com.arsi.mj.maprpt.lexer.tokens.ICommandToken aCmdToken)
Parse the rest of a double quoted string literal from an input at-sign line, where a token representing the opening double quote was the very last command token returned by the lexer.
Throws:
MJTranslateException - if a dangling double quote is detected.
Returns:
a quoted string token.
public com.arsi.mj.maprpt.lexer.tokens.cmd.QuotedStringToken parseRemainingDoubleQuotedString()
    throws com.arsi.mj.MJTranslateException
Push token back to lexer so that getting the next token returns the pushed back token instead of parsing a new token from the input.
Parameters:
aToken - token to push back.
public void pushbackToken(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aToken)
Read ahead to find index of left bracket in input that starts an array dimension, useful primarily when parsing an array declaration (e.g., LDA command).
Parameters:
aCmdLexerState - object that holds state while parsing command tokens from at-sign line.
Returns:
index of left bracket that starts an array dimension, where index matches the token index of the left bracket token that would eventually be returned by calling getNextToken on this lexer, or -1 if none found before array declaration is presumed to end (e.g., found blank., period or end-of-line).
public int readAheadForArrayDimension(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken)
    throws com.arsi.mj.MJTranslateException
Re-define the character that delimits "quoted" strings, i.e., causes a QuotedStringToken token to be recognized, parsed and returned by getNextToken.
Parameters:
aDelimChar - character that delimits "quoted" strings.
public void redefineQuotedStringDelimiter(char aDelimChar)
Get number of Mapper report being parsed.
public final int reportNumber()
Clear any re-definition of the character that delimits "quoted" strings, restoring a single quote as the quoted string delimiter.
public void resetQuotedStringDelimiter()
Set whether a single quote typically used to delimited a quoted string is escaped by doubling the single quote (e.g., 'Wayne''s World').
Parameters:
anEscapeByDoublingFlag - true to escape single quote by doubling up, or false if not escaping by doubling up.
public void setEscapeQuotedStringDelimiterByDoubling(boolean anEscapeByDoublingFlag)
Set token replacement context that contains token replacements (token name and replacement value) extracted from :DEFINEs while parsing the Mapper report.
Parameters:
aTokenReplCtx - token replacements (token name and replacement value) extracted from :DEFINEs.
public final void setTokenReplacementContext(com.arsi.mj.maprpt.lexer.TokenReplacementContext aTokenReplCtx)
Set class of command token that should be returned to signal end-of-command when end of an at-sign line is encountered. This class must have a public constructor that takes one argument, the at-sign line (AtLine) whose end was detected.
By default, a PeriodToken is returned to signal end-of-command when end of an at-sign line is encountered. To change the token, call this method immediately after creating an instance of the lexer.
Parameters:
anEndOfLineCmdTokenClass - typically either the class of PeriodToken for RUN commands or SemicolonToken if using the lexer to parse SC directives.
public void useCommandTokenAsEndOfLine(java.lang.Class anEndOfLineCmdTokenClass)

Class: MaprptReferenceResolver   previous next package

Resolves references to Mapper reports using previously discovered Mapper artifacts. Treat this class as "thread-safe" since an instance is immutable once created.

public class com.arsi.mj.maprpt.lexer.MaprptReferenceResolver
  extends java.lang.Object
Constructors
Initializes an instance of this class.
Parameters:
someCabinets - cabinets discovered on the class path by MapperArtifactDiscovery.
public MaprptReferenceResolver(java.util.List someCabinets)
Methods
Resolve Mapper cabinet, drawer and report number to a object that describes an exported report file.
Parameters:
aCabinetNumber - cabinet number of report.
aDrawerLetter - drawer of report within cabinet.
aReportNumber - number of report within drawer.
Returns:
report object or NULL if no such exported report.
public com.arsi.mj.config.MapperArtifactDiscovery.Report resolveReport(int aCabinetNumber, char aDrawerLetter, int aReportNumber)
Resolve Mapper cabinet, drawer and report number to file that contains the exported report contents.
Parameters:
aCabinetNumber - cabinet number of report.
aDrawerLetter - drawer of report within cabinet.
aReportNumber - number of report within drawer.
Throws:
MJTranslateException - if I/O exception occur resolving cabinet, drawer and report to physical file.
Returns:
file or NULL if no such exported report.
public java.io.File resolveReportAsFile(int aCabinetNumber, char aDrawerLetter, int aReportNumber)
    throws com.arsi.mj.MJTranslateException

Class: MaprptTokenReplacer   previous next package

Replaces alphanumeric tokens in a line of content with token stored in a token replacement context, i.e., handles the substitution of :DEFINEd constants in a text line. This class is typically used to pre-process text lines in the output area.
public class com.arsi.mj.maprpt.lexer.MaprptTokenReplacer
  extends java.lang.Object
Constructors
Initializes an instance of this class.
Parameters:
aTokenReplCtx - result of previous parse of Mapper report.
public MaprptTokenReplacer(com.arsi.mj.maprpt.lexer.TokenReplacementContext aTokenReplCtx)
Methods
Remove characters from candidate replacement token, if any, that occur within previous exempt-from-replacement span.
Parameters:
aCandidateReplacementToken - alphanumeric token that may be a replacement token (:DEFINEd constant).
anExemptSpan - span of characters in input that are exempt from token replacement, may be NULL if none.
Returns:
candidate replacement token with exempt portion (if any) removed.
public static com.arsi.mj.maprpt.lexer.tokens.cmd.AlphanumStringToken exemptFromReplacement(com.arsi.mj.maprpt.lexer.tokens.cmd.AlphanumStringToken aCandidateReplacementToken, com.arsi.mj.maprpt.lexer.MaprptTokenReplacer.ReplacedTokenExemptionSpan anExemptSpan)
Replace alphanumeric tokens in the input line with equivalent values from token replacement context.
Parameters:
aTextLine - Mapper text content (e.g., line from output area).
Returns:
input line with all token replacements resolved.
public java.lang.String replaceDefinedTokens(java.lang.String aTextLine)
Create shortened permutations of token by decrementing the token length successively by 1, for example, abc becomes abc, ab and a.
Parameters:
aToken - alphanumeric token to generate permutations for.
Returns:
list of permutations by length, where length ranges from whole length to 1 in descending order.
public static java.util.List tokenPermutationsByLengthDescending(com.arsi.mj.maprpt.lexer.tokens.cmd.AlphanumStringToken aToken)

Class: TokenReplacementContext   previous package

Context that is developed during lexical analysis of Mapper run control report to store DEFINE constants and their replacement strings.
Treat this class as "thread-hostile"; it is designed to be used by a single thread at a time.
public class com.arsi.mj.maprpt.lexer.TokenReplacementContext
  extends java.lang.Object
Inner Class TokenReplacement
Bundles a token and the token's replacement string, and any child token replacements that pertain only when this token replacement is matched.
public static class com.arsi.mj.maprpt.lexer.TokenReplacementContext.TokenReplacement
  extends java.lang.Object
public void addChildReplacment(com.arsi.mj.NameValuePair aChildTokenAndRepl)
Get the child token replacements (returns an empty map if none).
public final java.util.Map getChildTokenReplacements()
Get the token (name) and the token's replacement string (value).
public final com.arsi.mj.NameValuePair getTokenAndReplacement()
Constructors
public TokenReplacementContext()
Methods
Add a "related" child token replacement.
Parameters:
aParentToken - name of parent token. which must exist.
anChildNVPair - child token replacement (token is name and replacement string is value) that pertains only when aParentToken token replacement is matched.
public boolean addChildReplacement(java.lang.String aParentToken, com.arsi.mj.NameValuePair anChildNVPair)
Add a token replacement.
Parameters:
anNVPair - token replacement, where token is name and replacement string is value.
public void addReplacement(com.arsi.mj.NameValuePair anNVPair)
Lookup child token in list of candidate parent token replacements.
Parameters:
aToken - token to lookup, presumed to be a child token, i.e., only valid in the context of one of the parent token replacements in someTokenRepl.
someTokenRepl - candidate parent token replacements.
Returns:
replacement string for child token, or NULL if not found.
public java.lang.String lookupChildToken(java.lang.String aToken, java.util.Collection someTokenRepl)
Lookup token to find it's replacement string, if any.
Parameters:
aToken - token to lookup.
Throws:
MJTranslateException - if a circular reference exists among token replacements.
Returns:
token replacement object that includes replacement string, or NULL if no replacement.
public com.arsi.mj.maprpt.lexer.TokenReplacementContext.TokenReplacement lookupToken(java.lang.String aToken)
    throws com.arsi.mj.MJTranslateException