ilog.rules.brl.translation.codegen

Class IlrIRLCodeGenerator

    • Constructor Detail

      • IlrIRLCodeGenerator

        public IlrIRLCodeGenerator()
    • Method Detail

      • getTargetLanguage

        public java.lang.String getTargetLanguage()
        Returns "irl".
        Returns:
        "irl".
      • printComment

        public void printComment(java.lang.String comment)
        Prints an IRL comment.
        Parameters:
        comment - the comment to print
      • printRule

        public void printRule(IlrRuleStatement rule)
        Prints a rule statement.
        Parameters:
        rule - The rule statement to print.
      • addStandardProperties

        protected void addStandardProperties(IlrRuleStatement rule,
                                 java.util.Map properties)
        This method add some standard properties to the Map given as argument. Typically business name and package business name are added, as 'ilog.rules.trace.business_name' and 'ilog.rules.package_name'
        Parameters:
        rule - a rule statement
        properties - a non-null property map
      • printProperties

        public void printProperties(java.util.Map properties)
        Prints rule properties.
        Parameters:
        properties - The map of properties to print.
      • printDocumentation

        public void printDocumentation(java.lang.String documentation)
        Prints documentation as a IRL comment.
        Parameters:
        documentation - The documentation.
      • printCodeStatement

        public void printCodeStatement(IlrCodeStatement stmt)
        Prints a code statement code.
        Parameters:
        stmt - The code statement.
      • printUseHeader

        public void printUseHeader(IlrHeaderStatement header)
        Prints a 'use' clause.
        Parameters:
        header - The IlrHeaderStatement.
      • printSimpleBinding

        public void printSimpleBinding(IlrSimpleBindingStatement stmt)
        Prints simple binding.
        Parameters:
        stmt - The simple binding statement.
      • printOriginClause

        public void printOriginClause(IlrSimpleBindingStatement stmt)
        Prints the origin clause (the 'from' or the 'in') of a simple binding statement.
        Parameters:
        stmt - The simple binding statement.
      • printInClause

        public void printInClause(IlrSyntaxTree.Node node,
                         IlrStatement stmt)
        Prints a IN clause of a binding.
        Parameters:
        node - The syntax tree node.
        stmt - The statement.
      • printFromClause

        public void printFromClause(IlrSyntaxTree.Node node,
                           IlrStatement stmt)
        Prints a FROM clause of a binding.
        Parameters:
        node - The syntax tree node.
        stmt - The statement.
      • printNotBinding

        public void printNotBinding(IlrSimpleBindingStatement stmt)
        Prints a NOT binding.
        Parameters:
        stmt - The simple binding.
      • printExistsBinding

        public void printExistsBinding(IlrSimpleBindingStatement stmt)
        Prints a EXISTS binding.
        Parameters:
        stmt - The simple binding.
      • printCollectBinding

        public void printCollectBinding(IlrSimpleBindingStatement stmt)
        Prints a COLLECT binding.
        Parameters:
        stmt - The simple binding.
      • printEvaluateBinding

        public void printEvaluateBinding(IlrSimpleBindingStatement stmt)
        Prints a EVALUATE binding.
        Parameters:
        stmt - The simple binding.
      • printExpressionNode

        public void printExpressionNode(IlrSyntaxTree.Node node,
                               IlrStatement stmt,
                               java.lang.String expectedType)
        Prints a BAL expression node. If the expression node is not one of the BRLDF predefined expressions (defined in expr.xsd), then an extender for the specified node is searched. If one exists, the extender printExpression() is called.
      • printSentenceNode

        public void printSentenceNode(IlrSyntaxTree.Node node,
                             IlrStatement stmt,
                             java.lang.String expectedType)
        Prints a node that references an IlrSentence.
        Parameters:
        node - The sentence node.
        stmt - The associated statement.
        expectedType - The expected type or null.
      • printVariableNode

        public void printVariableNode(IlrSyntaxTree.Node node,
                             IlrStatement stmt,
                             java.lang.String expectedType)
        Prints variable node.
        Parameters:
        node - The variable node.
        stmt - The statement.
        expectedType - The expected type or null.
      • printValueNode

        public void printValueNode(IlrSyntaxTree.Node node,
                          java.lang.String expectedType)
        Prints a value node.
        Parameters:
        node - The value node.
        expectedType - The expected type or null.
      • printSimpleAction

        public void printSimpleAction(IlrSimpleActionStatement stmt)
        Prints a simple action.
        Parameters:
        stmt - The action statement.
      • printUpdateContext

        public void printUpdateContext(IlrSimpleActionStatement stmt)
        Prints an update action.
        Parameters:
        stmt - The action statement.
      • printVariableAssignment

        public void printVariableAssignment(IlrSimpleActionStatement stmt)
        Prints a variable assignment action.
        Parameters:
        stmt - The action statement.
      • printUpdateObjectAction

        public void printUpdateObjectAction(IlrSimpleActionStatement stmt)
        Prints an update object action.
        Parameters:
        stmt - The statement.
      • printForEachAction

        public void printForEachAction(IlrBlockActionStatement stmt)
        Prints a "for each" action.
        Parameters:
        stmt - The action statement.
      • getImplicitVariableText

        public java.lang.String getImplicitVariableText(IlrSyntaxTree.Node node,
                                               IlrStatement stmt)
        Gets the text to be generated for an implicit variable.
        Parameters:
        node - The node.
        stmt - The statement.
        Returns:
        The text for the implicit variable.
      • getIRLTranslation

        public java.lang.String getIRLTranslation(IlrSentence sentence,
                                         IlrSyntaxTree.Node node)
        Gets the IRL code generation template for the sentence.

        It first looks for the property "translation" in the BOM. If no value is returned, it produces a template depending on the sentence category and the underlying member.

        Parameters:
        sentence - The sentence.
        node - The syntax tree node.
      • makeDefaultIRLCodeTemplate

        protected java.lang.String makeDefaultIRLCodeTemplate(IlrSentence sentence)
        Produces a default template for navigation sentence translation.
        Parameters:
        sentence - The sentence.
        Returns:
        The produced default generation template.
      • makeSetterIRLCodeTemplate

        protected java.lang.String makeSetterIRLCodeTemplate(IlrSentence sentence)
        Produces a default template for setter sentence translation.
        Parameters:
        sentence - The sentence.
        Returns:
        The produced default generation template.

© Copyright IBM Corp. 1987, 2017