Package wprover

Class CTextValue


  • public class CTextValue
    extends java.lang.Object
    CTextValue is a class that represents a mathematical expression in a tree structure. It can parse a string representation of the expression, evaluate it, and perform various mathematical functions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] sfunction  
    • Constructor Summary

      Constructors 
      Constructor Description
      CTextValue()
      Default constructor for CTextValue.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static double cal_func​(int n, double v)
      Calculates the result of a mathematical function on a given value.
      void calculate​(DrawProcess dp)
      Calculates the value of this CTextValue object using the specified DrawProcess.
      static double calvalue​(CTextValue ct, DrawProcess dp)
      Calculates the value of the specified CTextValue object using the specified DrawProcess.
      static int getFunction​(java.lang.String s)
      Gets the function index for a given function name.
      static CTextValue parse​(byte[] src, TMono index)
      Parses a byte array representation of a mathematical expression into a CTextValue object.
      static java.lang.String parseFunction​(char[] src, TMono index)
      Parses a function name from the source character array.
      static CTextValue parseString​(java.lang.String str)
      Parses a string representation of a mathematical expression into a CTextValue object.
      static double roud3​(double r)
      Rounds a double value to three decimal places.
      • Methods inherited from class java.lang.Object

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

      • sfunction

        public static final java.lang.String[] sfunction
    • Constructor Detail

      • CTextValue

        public CTextValue()
        Default constructor for CTextValue.
    • Method Detail

      • parseString

        public static CTextValue parseString​(java.lang.String str)
        Parses a string representation of a mathematical expression into a CTextValue object.
        Parameters:
        str - the string representation of the expression
        Returns:
        the parsed CTextValue object
      • parse

        public static CTextValue parse​(byte[] src,
                                       TMono index)
        Parses a byte array representation of a mathematical expression into a CTextValue object.
        Parameters:
        src - the byte array representation of the expression
        index - the index used for parsing
        Returns:
        the parsed CTextValue object
      • getFunction

        public static int getFunction​(java.lang.String s)
        Gets the function index for a given function name.
        Parameters:
        s - the function name
        Returns:
        the index of the function, or -1 if not found
      • parseFunction

        public static java.lang.String parseFunction​(char[] src,
                                                     TMono index)
        Parses a function name from the source character array.
        Parameters:
        src - the source character array
        index - the index used for parsing
        Returns:
        the parsed function name
      • roud3

        public static double roud3​(double r)
        Rounds a double value to three decimal places.
        Parameters:
        r - the double value to round
        Returns:
        the rounded double value
      • calculate

        public void calculate​(DrawProcess dp)
        Calculates the value of this CTextValue object using the specified DrawProcess.
        Parameters:
        dp - the DrawProcess used for calculation
      • calvalue

        public static double calvalue​(CTextValue ct,
                                      DrawProcess dp)
        Calculates the value of the specified CTextValue object using the specified DrawProcess.
        Parameters:
        ct - the CTextValue object to calculate
        dp - the DrawProcess used for calculation
        Returns:
        the calculated double value
      • cal_func

        public static double cal_func​(int n,
                                      double v)
        Calculates the result of a mathematical function on a given value.
        Parameters:
        n - the function index
        v - the value to apply the function to
        Returns:
        the result of the function