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

 

Package: com.arsi.mj.maprpt.lexer.ptree.cmd.iff  previous next contents

Package com.arsi.mj.maprpt.lexer.ptree.cmd.iff contains the following classes and interfaces.
Classes and Interfaces
ComputedGotoParseNode Parse node that represents a IF RUN command with computed-goto syntax (as opposed to IF-THEN-ELSE syntax).
IfCommandParser Parses a IF RUN command.
IfParseNode Base class for parse nodes that represents flavors of IF RUN command.
IfThenElseParseNode Parse node that represents a IF RUN command with the IF-THEN or IF-THEN-ELSE syntax (as opposed to a computed-goto).

Class: ComputedGotoParseNode   next package

Parse node that represents a IF RUN command with computed-goto syntax (as opposed to IF-THEN-ELSE syntax).
Treat this class as "thread-hostile" since it may hold substantial state without method synchronization; instances should only be used by single thread at a time.

public class com.arsi.mj.maprpt.lexer.ptree.cmd.iff.ComputedGotoParseNode
  extends com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode
  implements com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IJumptoCmdInfo, com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IMapperSubexprCmdInfo, com.arsi.mj.maprpt.lexer.symtab.ISupportsVariableReference
Constructors
Initializes an instance of this class.
Parameters:
aHostLine - Mapper report line that hosts this command.
anOptionExpr - option expression parsed from IF command, may be NULL if command has no options.
someFirstOperandExprs - first operand in IF command, as list of expressions.
aFirstOperandRelop - relational operator that applies to first operand.
someGotoOperands - represents the operands (values to match and line/label to goto on match) in a computed-goto IF statement.
public ComputedGotoParseNode(com.arsi.mj.maprpt.parser.line.types.AtLine aHostLine, com.arsi.mj.maprpt.lexer.ptree.expr.ICommandOptionExpr anOptionExpr, java.util.List someFirstOperandExprs, com.arsi.mj.maprpt.lexer.ptree.symbol.RelationalOperator aFirstOperandRelop, java.util.List someGotoOperands)
Methods
public boolean allowFallthru()
Get ID that uniquely identifies MapperSubexprInfo object for ELSE parse tree returned by this command node via IMapperSubexprCmdInfo interface.
Returns:
ID passed to subExpressions method of IMapperSubexprCmdInfo interface, or -1 if method not called on this command parse tree node or no ELSE clause.
public final int getElseSubexprCmdInfoId()
Get the goto operands, where an operand is one or more value expressions to match and line or label to jump when value of expression is matched.
Returns:
the goto operands.
public final java.util.List getGotoOperands()
Perform recursive introspection to discover jump-to expressions in goto operands and ELSE clauses.
See Also:
com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IJumptoCmdInfo#jumptoExpressions(int)
public java.util.List jumptoExpressions(int anId)
Perform recursive introspection to discover jump-to literals in goto operands and ELSE clauses.
See Also:
com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IJumptoCmdInfo#jumptoLiterals(int)
public java.util.List jumptoLiterals(int anId)
public java.util.List referencedVariables()
Perform recursive introspection to discover Mapper sub-commands in ELSE clause.
See Also:
com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IMapperSubexprCmdInfo#subExpressions(int)
public java.util.List subExpressions(int anId)

Class: IfCommandParser   previous next package

Parses a IF RUN command.
Treat this class as "thread-hostile"; instances should be created, used and discarded by single thread at a time.

public class com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfCommandParser
  extends com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase
  implements com.arsi.mj.maprpt.lexer.ptree.cmd.IRunCommandParser
Inner Class GotoOperand
Represents an operand in a computed-goto IF statement.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfCommandParser.GotoOperand
  extends java.lang.Object
Expression that yields label or line offset, NULL if literalCallback is not NULL.
public final com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr jumpExpr

Stores literal label or line number offset, NULL if concatExpr is not NULL.
public final com.arsi.mj.maprpt.lexer.ptree.cmd.litcbk.JumpExprCallback literalCallback

Value expressions to match, where each expression is an operand choice (OR'd operands).
public final java.util.List valueExprs

Get ID that uniquely identifies either LiteralJumpInfo or ConcatExprJumpInfo associated with this GOTO operand via IJumptoCmdInfo interface.
Returns:
ID passed to jumptoLiterals or jumptoExpressions method of IJumptoCmdInfo interface, or -1 if no ID associated with this GOTO operand.
public final int getJumptoCmdInfoId()
Set ID that associates either LiteralJumpInfo or ConcatExprJumpInfo from the IJumptoCmdInfo interface with this GOTO operand.
Parameters:
anId - ID assigned to jump-to-info object (and edge).
public final void setJumptoCmdInfoId(int anId)
Inner Class RelationalOperatorAndOperand
Bundles relational operator and right-side operand (left-side operand is implied by context in which instance of this class is used).
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfCommandParser.RelationalOperatorAndOperand
  extends java.lang.Object
public final java.util.List exprs
public final com.arsi.mj.maprpt.lexer.ptree.symbol.RelationalOperator relop
Constructors
public IfCommandParser()
Methods
public com.arsi.mj.maprpt.lexer.ptree.cmd.CommandParseResult parseCommand(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, org.springframework.context.ApplicationContext anAppCtx)
    throws com.arsi.mj.MJTranslateException
Parse computed goto operand, which may be a single concatenation expression or a list of comma-separated concatenation expressions.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens (any tokens read are eaten).
aUserRID - report ID string that is meaningful to user as an error context.
aLineNumber - line number in report where command option occurs.
Returns:
result that contains operands as list of concatenation expressions and jump expression to that directs flow of RUN if operand value is matched.
public com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfCommandParser.GotoOperandResult parseGotoOperand(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, java.lang.String aUserRID, int aLineNumber)
Parse IF operand, which may be a single concatenation expression or a list of comma-separated concatenation expressions.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens (any tokens read are eaten).
aUserRID - report ID string that is meaningful to user as an error context.
aLineNumber - line number in report where command option occurs.
Returns:
result that contains operands as list of concatenation expressions.
public com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfCommandParser.IfOperandResult parseIfOperand(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, java.lang.String aUserRID, int aLineNumber)

Class: IfParseNode   previous next package

Base class for parse nodes that represents flavors of IF RUN command.
Treat this class as "thread-hostile" since it holds substantial state without method synchronization; instances should only be used by single thread at a time.

public abstract class com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode
  extends com.arsi.mj.maprpt.lexer.ptree.CommandParseNode
Inner Class Option
Enumerated options for IF command, associated with option letter. This class must implement that static method fromString for use with class StrCmdOptionConcatExpr.
public static final class com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option
  extends java.lang.Enum
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option CASE_SENSITIVE
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE0
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE1
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE11
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE12
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE14
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE15
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE16
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE18
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE19
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE2
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE20
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE3
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE4
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE5
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE6
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE7
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE8
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option DATE9
public java.lang.String asString()
public static com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option fromString(java.lang.String anOptstr)
public static com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option valueOf(java.lang.String name)
public static com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode.Option values()
Fields
Indicates if statements(s) in ptreeThen were terminated by a period, meaning that ptreeElse is only executed when IF condition is false. If not a proper if-then-else, ptreeElse is always executed (if not null or empty) regardless of whether IF condition evaluates to true or false.
public boolean isProperIfThenElse
Constructors
Initializes an instance of this class.
Parameters:
aHostLine - Mapper report line that hosts this command.
anOptionExpr - option expression parsed from IF command, may be NULL if command has no options.
someFirstOperandExprs - first operand in IF command, as list of expressions.
aFirstOperandRelop - relational operator that applies to first operand.
public IfParseNode(com.arsi.mj.maprpt.parser.line.types.AtLine aHostLine, com.arsi.mj.maprpt.lexer.ptree.expr.ICommandOptionExpr anOptionExpr, java.util.List someFirstOperandExprs, com.arsi.mj.maprpt.lexer.ptree.symbol.RelationalOperator aFirstOperandRelop)
Methods
Get parse tree of statements to execute when IF condition is false (or after THEN statements, see isProperIfThenElse).
Returns:
"else" parse tree, may be null or empty.
public final com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree getElseParseTree()
Get first operand in IF command, which is typically a reference to a variable whose value is to be tested, or a literal if variable is on the right-side of the relational operator. The Mapper interpreter supports a choice of operands (OR'd operands) instead of a single operand, thus the list of expressions. For example, a variable on the right-side of the relational operator may be tested against multiple values.
Returns:
first operand in IF command, as list of expressions.
public final java.util.List getFirstOperandExprs()
Get the relational operator that applies to first operand (e.g., LESS_THAN).
Returns:
relational operator that applies to first operand.
public final com.arsi.mj.maprpt.lexer.ptree.symbol.RelationalOperator getFirstOperandRelop()
Collect jump-to expressions from IF-THEN or ELSE parse tree.
Parameters:
anId - starting ID to assign to jump-to-info objects (and edges).
someJumpInfo - list that collects jump-to-info objects.
aParseTree - IF-THEN or ELSE parse tree.
protected void getJumptoExpressionsFromParseTree(int anId, java.util.List someJumpInfo, com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree aParseTree)
Collect jump-to literals from IF-THEN or ELSE parse tree.
Parameters:
anId - starting ID to assign to jump-to-info objects (and edges).
someJumpInfo - list that collects jump-to-info objects.
aParseTree - IF-THEN or ELSE parse tree.
protected void getJumptoLiteralsFromParseTree(int anId, java.util.List someJumpInfo, com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree aParseTree)
Get options applicable to command.
Returns:
options applicable to command or NULL if none.
public final com.arsi.mj.maprpt.lexer.ptree.expr.ICommandOptionExpr getOptions()
Collect sub-expressions from IF-THEN or ELSE parse tree.
Parameters:
anId - starting ID to assign to sub-expression-info objects (and edges).
someJumpInfo - list that collects sub-expression-info objects.
aParseTree - IF-THEN or ELSE parse tree.
protected void getSubExpressionsFromParseTree(int anId, java.util.List someSubexprInfo, com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree aParseTree)
Get parse tree of statements to execute when IF condition is true.
Returns:
"then" parse tree, may be null or empty (e.g., computed goto or no statements after IF condition, only a period).
public final com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree getThenParseTree()
Is a GTO command the last command node in the parse tree?
Parameters:
aParseTree - IF-THEN or ELSE parse tree.
protected boolean isGotoLastCommandInParseTree(com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree aParseTree)
Indicates if ELSE statements are only executed when IF condition is false. If not a proper if-then-else,ELSE statements are always executed (if not null or empty) regardless of whether IF condition evaluates to true or false.
Returns:
true if this IF statement has proper IF-THEN-ELSE semantics, false if ELSE condition is evaluated regardless of boolean result of IF condition.
public boolean isProperIfThenElse()
Set parse tree of statements to execute when IF condition is false.
Parameters:
aParseTree - "else" parse tree, may be null or empty.
public final void setElseParseTree(com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree aParseTree)
Set whether ELSE statements are only executed when IF condition is false (i.e., a "proper" IF-THEN-ELSE statement).
Parameters:
aProperFlag - true if this IF statement has proper IF-THEN-ELSE semantics, false if ELSE condition is evaluated regardless of boolean result of IF condition.
public void setProperIfThenElse(boolean aProperFlag)
Set parse tree of statements to execute when IF condition is true.
Parameters:
aParseTree - "then" parse tree, may be null or empty.
public final void setThenParseTree(com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree aParseTree)

Class: IfThenElseParseNode   previous package

Parse node that represents a IF RUN command with the IF-THEN or IF-THEN-ELSE syntax (as opposed to a computed-goto).
This parse node contains embedded parse tree(s); therefore, with respect to discovery required by IMapperSubexprCmdInfo and IJumptoCmdInfo interfaces, it must perform recursive introspection.
Treat this class as "thread-hostile" since it may hold substantial state without method synchronization; instances should only be used by single thread at a time.

public class com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfThenElseParseNode
  extends com.arsi.mj.maprpt.lexer.ptree.cmd.iff.IfParseNode
  implements com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IJumptoCmdInfo, com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IMapperSubexprCmdInfo, com.arsi.mj.maprpt.lexer.symtab.ISupportsVariableReference
Constructors
Initializes an instance of this class.
Parameters:
aHostLine - Mapper report line that hosts this command.
anOptionExpr - option expression parsed from IF command, may be NULL if command has no options.
someFirstOperandExprs - first operand in IF command, as list of expressions.
aFirstOperandRelop - relational operator that applies to first operand.
someSecondOperandExprs - second operand in IF command (follows first operand and relational operator).
someExtraOperands - additional relational operator(s) and right-side operands connected to second operand via AND (ampersand) operator.
public IfThenElseParseNode(com.arsi.mj.maprpt.parser.line.types.AtLine aHostLine, com.arsi.mj.maprpt.lexer.ptree.expr.ICommandOptionExpr anOptionExpr, java.util.List someFirstOperandExprs, com.arsi.mj.maprpt.lexer.ptree.symbol.RelationalOperator aFirstOperandRelop, java.util.List someSecondOperandExprs, java.util.List someExtraOperands)
Methods
public boolean allowFallthru()
Get ID that uniquely identifies MapperSubexprInfo object for ELSE parse tree returned by this command node via IMapperSubexprCmdInfo interface.
Returns:
ID passed to subExpressions method of IMapperSubexprCmdInfo interface, or -1 if method not called on this command parse tree node or no ELSE clause.
public final int getElseSubexprCmdInfoId()
Get additional relational operator(s) and right-side operands connected to second operand via AND (ampersand) operator.
Returns:
additional relational operator(s) and right-side operands, or empty list if none.
public final java.util.List getExtraOperands()
Get second operand in IF command (follows first operand and relational operator), such as reference to a variable whose value is to be compared (or tested), or a literal. All relational operators are binary and require two arguments.
This may be a choice of operands (OR'd operands) instead of a single operand, thus the list of expressions. For example, a variable on left-side of relational operator (1st operand) may be tested against multiple values (2nd operand).
Returns:
second operand in IF command, as list of expressions.
public final java.util.List getSecondOperandExprs()
Get ID that uniquely identifies MapperSubexprInfo object for IF-THEN parse tree returned by this command node via IMapperSubexprCmdInfo interface.
Returns:
ID passed to subExpressions method of IMapperSubexprCmdInfo interface, or -1 if method not called on this command parse tree node.
public final int getThenSubexprCmdInfoId()
Perform recursive introspection to discover jump-to expressions in IF-THEN and ELSE clauses.
See Also:
com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IJumptoCmdInfo#jumptoExpressions(int)
public java.util.List jumptoExpressions(int anId)
Perform recursive introspection to discover jump-to literals in IF-THEN and ELSE clauses.
See Also:
com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IJumptoCmdInfo#jumptoLiterals(int)
public java.util.List jumptoLiterals(int anId)
public java.util.List referencedVariables()
Perform recursive introspection to discover Mapper sub-commands in IF-THEN and ELSE clauses.
See Also:
com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.IMapperSubexprCmdInfo#subExpressions(int)
public java.util.List subExpressions(int anId)