Class CommonLangWriter

  • All Implemented Interfaces:
    org.lemsml.jlems.core.expression.ExpressionVisitor
    Direct Known Subclasses:
    CVisitors, MatlabVisitors, PythonVisitors

    public class CommonLangWriter
    extends Object
    implements org.lemsml.jlems.core.expression.ExpressionVisitor
    Author:
    boris
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected StringBuilder sb  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getAdd()  
      String getArgEnd()  
      String getArgStart()  
      String getDiv()  
      String getMod()  
      String getMult()  
      String getPow()  
      String getSub()  
      String serialize​(org.lemsml.jlems.core.expression.ParseTree pt)  
      void setAdd​(String _add)  
      void setArgEnd​(String _argEnd)  
      void setArgStart​(String _argStart)  
      void setDiv​(String _div)  
      void setMod​(String _mod)  
      void setMult​(String _mult)  
      void setPow​(String _pow)  
      void setSub​(String _sub)  
      void visitAndNode​(org.lemsml.jlems.core.expression.BooleanParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.BooleanParseTreeNode rightEvaluable)  
      void visitConstant​(double dval)  
      void visitDivideNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitFunctionNode​(String fname, org.lemsml.jlems.core.expression.DoubleParseTreeNode argEvaluable)  
      void visitGreaterThanNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitGreaterThanOrEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitLessThanNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitLessThanOrEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitMinusNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitModuloNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitNotEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      protected void visitOp​(String opname, org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitOrNode​(org.lemsml.jlems.core.expression.OrNode orNode)  
      void visitPlusNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitPowerNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitTimesNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable, org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitUnaryMinusNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)  
      void visitVariable​(String svar)  
    • Constructor Detail

      • CommonLangWriter

        public CommonLangWriter()
    • Method Detail

      • serialize

        public String serialize​(org.lemsml.jlems.core.expression.ParseTree pt)
                         throws org.lemsml.jlems.core.sim.ContentError
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitVariable

        public void visitVariable​(String svar)
        Specified by:
        visitVariable in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitFunctionNode

        public void visitFunctionNode​(String fname,
                                      org.lemsml.jlems.core.expression.DoubleParseTreeNode argEvaluable)
                               throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitFunctionNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitConstant

        public void visitConstant​(double dval)
        Specified by:
        visitConstant in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitOp

        protected void visitOp​(String opname,
                               org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                               org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                        throws org.lemsml.jlems.core.sim.ContentError
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitPlusNode

        public void visitPlusNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                  org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                           throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitPlusNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitTimesNode

        public void visitTimesNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                   org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                            throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitTimesNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitPowerNode

        public void visitPowerNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                   org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                            throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitPowerNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitMinusNode

        public void visitMinusNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                   org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                            throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitMinusNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitUnaryMinusNode

        public void visitUnaryMinusNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                                 throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitUnaryMinusNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitDivideNode

        public void visitDivideNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                    org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                             throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitDivideNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitModuloNode

        public void visitModuloNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                    org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
                             throws org.lemsml.jlems.core.sim.ContentError
        Specified by:
        visitModuloNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
        Throws:
        org.lemsml.jlems.core.sim.ContentError
      • visitOrNode

        public void visitOrNode​(org.lemsml.jlems.core.expression.OrNode orNode)
        Specified by:
        visitOrNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitNotEqualsNode

        public void visitNotEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                       org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
        Specified by:
        visitNotEqualsNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitAndNode

        public void visitAndNode​(org.lemsml.jlems.core.expression.BooleanParseTreeNode leftEvaluable,
                                 org.lemsml.jlems.core.expression.BooleanParseTreeNode rightEvaluable)
        Specified by:
        visitAndNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitLessThanOrEqualsNode

        public void visitLessThanOrEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                              org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
        Specified by:
        visitLessThanOrEqualsNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitLessThanNode

        public void visitLessThanNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                      org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
        Specified by:
        visitLessThanNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitGreaterThanOrEqualsNode

        public void visitGreaterThanOrEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                                 org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
        Specified by:
        visitGreaterThanOrEqualsNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitGreaterThanNode

        public void visitGreaterThanNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                         org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
        Specified by:
        visitGreaterThanNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • visitEqualsNode

        public void visitEqualsNode​(org.lemsml.jlems.core.expression.DoubleParseTreeNode leftEvaluable,
                                    org.lemsml.jlems.core.expression.DoubleParseTreeNode rightEvaluable)
        Specified by:
        visitEqualsNode in interface org.lemsml.jlems.core.expression.ExpressionVisitor
      • getArgStart

        public String getArgStart()
        Returns:
        the _argStart
      • setArgStart

        public void setArgStart​(String _argStart)
        Parameters:
        _argStart - the _argStart to set
      • getArgEnd

        public String getArgEnd()
        Returns:
        the _argEnd
      • setArgEnd

        public void setArgEnd​(String _argEnd)
        Parameters:
        _argEnd - the _argEnd to set
      • getMult

        public String getMult()
        Returns:
        the _mult
      • setMult

        public void setMult​(String _mult)
        Parameters:
        _mult - the _mult to set
      • getAdd

        public String getAdd()
        Returns:
        the _add
      • setAdd

        public void setAdd​(String _add)
        Parameters:
        _add - the _add to set
      • getSub

        public String getSub()
        Returns:
        the _sub
      • setSub

        public void setSub​(String _sub)
        Parameters:
        _sub - the _sub to set
      • getDiv

        public String getDiv()
        Returns:
        the _div
      • setDiv

        public void setDiv​(String _div)
        Parameters:
        _div - the _div to set
      • getPow

        public String getPow()
        Returns:
        the _pow
      • setPow

        public void setPow​(String _pow)
        Parameters:
        _pow - the _pow to set
      • getMod

        public String getMod()
        Returns:
        the _mod
      • setMod

        public void setMod​(String _mod)
        Parameters:
        _mod - the _mod to set