ilog.rules.brl.converter

Class IlrBRLConverter

  • java.lang.Object
    • ilog.rules.brl.converter.IlrBRLConverter
  • Direct Known Subclasses:
    IlrBRLHtmlConverter


    public class IlrBRLConverter
    extends java.lang.Object
    This class converts a syntax tree to a string representation.

    The locale of the target BRL language definition can be different from the syntax tree locale.

    Note that this converter is supposed to be used on a well-formed syntax tree and may generate unexpected exceptions if used on a incomplete or erroneous syntax tree.

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      protected void bol()
      Write a new line and indent that line to the current indentation.
      java.lang.String convert(IlrSyntaxTree syntaxTree)
      Convert a syntax tree into a string.
      protected void doConvert(IlrSyntaxTree.Node node)
      This method is called internally when converting the root of a syntax tree.
      protected java.lang.String findAutomaticVariableReference(IlrSyntaxTree.Node node, IlrBRLGrammarContext context) 
      protected ilog.rules.brl.semantic.IlrBRLLanguageVariable findLanguageVariable(java.lang.String name) 
      IlrBRLDefinition getDefinition()
      Returns the target BRL language definition.
      java.util.Locale getLocale()
      Returns the locale used to convert syntax trees.
      IlrVocabulary getVocabulary()
      Returns the target vocabulary.
      protected void indent()
      Indent by one indentation.
      protected void newline()
      Write a newline.
      protected void whiteSpace()
      Write a white space, if it is needed (no white space before).
      protected void write(char ch)
      Write a character into the conversion buffer.
      protected void write(java.lang.String text)
      Write a string into the conversion buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IlrBRLConverter

        public IlrBRLConverter(IlrVocabulary vocabulary,
                       IlrBRLDefinition definition)
        Create a BRL converter from a target vocabulary and a target BRL language definition.
        Parameters:
        vocabulary - The vocabulary.
        definition - The BRL language definition.
      • IlrBRLConverter

        public IlrBRLConverter(IlrVocabulary vocabulary,
                       IlrBRLDefinition definition,
                       IlrBRLVariableProvider variableProvider)
        Create a BRL converter from a target vocabulary, a target BRL language definition and a target variable provider. In order to convert form a locale to another.
        Parameters:
        vocabulary - The vocabulary.
        definition - The BRL language definition.
        variableProvider - The variable provider.
    • Method Detail

      • getVocabulary

        public IlrVocabulary getVocabulary()
        Returns the target vocabulary.
        Returns:
        The target vocabulary.
      • getDefinition

        public IlrBRLDefinition getDefinition()
        Returns the target BRL language definition.
        Returns:
        The target BRL language definition.
      • getLocale

        public java.util.Locale getLocale()
        Returns the locale used to convert syntax trees.
        Returns:
        The locale of the target BRL language definition.
      • write

        protected void write(char ch)
        Write a character into the conversion buffer.
        Parameters:
        ch - The character to write.
      • write

        protected void write(java.lang.String text)
        Write a string into the conversion buffer.
        Parameters:
        text - The string to write.
      • bol

        protected void bol()
        Write a new line and indent that line to the current indentation.
      • newline

        protected void newline()
        Write a newline.
      • indent

        protected void indent()
        Indent by one indentation. By default write a tabulation '\t'.
      • whiteSpace

        protected void whiteSpace()
        Write a white space, if it is needed (no white space before).
      • convert

        public java.lang.String convert(IlrSyntaxTree syntaxTree)
        Convert a syntax tree into a string.

        The conversion is done using the target BRL language definition. The syntax tree must have the same BRL language definition as the converter, but the locale can be different.

        Call to this method can generate unexpected exception if the syntax tree is erroneous or if the target vocabulary is incomplete.

        Parameters:
        syntaxTree - The syntax tree to convert.
        Returns:
        A string representation (generated from the BRL language definition) of the syntax tree.
      • doConvert

        protected void doConvert(IlrSyntaxTree.Node node)
        This method is called internally when converting the root of a syntax tree.
        Parameters:
        node - the root node
      • findLanguageVariable

        protected ilog.rules.brl.semantic.IlrBRLLanguageVariable findLanguageVariable(java.lang.String name)

© Copyright IBM Corp. 1987, 2017