Package wprover

Class Parser


  • public class Parser
    extends java.lang.Object
    Parser is a class that parses a mathematical expression represented as a string and converts it into a TMono object.
    • Constructor Summary

      Constructors 
      Constructor Description
      Parser​(java.lang.String n, java.lang.String f, int x)
      Constructs a new Parser with the specified name, function, and parameter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TMono getAterm​(byte[] bf, byte[] nm)
      Parses a term from the function string and returns it as a TMono object.
      boolean isAlpha​(byte b)
      Checks if the given byte represents an alphabetic character.
      boolean isNum​(byte b)
      Checks if the given byte represents a numeric character.
      TMono parse()
      Parses the function string and converts it into a TMono object.
      void parseBlank​(byte[] bf, byte[] nm)
      Skips blank spaces in the function string.
      void parseterm​(boolean first, byte[] bf, byte[] nm)
      Parses a term from the function string and updates the TMono object.
      • Methods inherited from class java.lang.Object

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

      • Parser

        public Parser​(java.lang.String n,
                      java.lang.String f,
                      int x)
        Constructs a new Parser with the specified name, function, and parameter.
        Parameters:
        n - the name of the parser
        f - the function to parse
        x - the parameter for the parser
    • Method Detail

      • parse

        public TMono parse()
        Parses the function string and converts it into a TMono object.
        Returns:
        the TMono object representing the parsed function
      • isNum

        public boolean isNum​(byte b)
        Checks if the given byte represents a numeric character.
        Parameters:
        b - the byte to check
        Returns:
        true if the byte is a numeric character, false otherwise
      • isAlpha

        public boolean isAlpha​(byte b)
        Checks if the given byte represents an alphabetic character.
        Parameters:
        b - the byte to check
        Returns:
        true if the byte is an alphabetic character, false otherwise
      • parseterm

        public void parseterm​(boolean first,
                              byte[] bf,
                              byte[] nm)
        Parses a term from the function string and updates the TMono object.
        Parameters:
        first - indicates if this is the first term being parsed
        bf - the byte array representing the function string
        nm - the byte array representing the name string
      • parseBlank

        public void parseBlank​(byte[] bf,
                               byte[] nm)
        Skips blank spaces in the function string.
        Parameters:
        bf - the byte array representing the function string
        nm - the byte array representing the name string
      • getAterm

        public TMono getAterm​(byte[] bf,
                              byte[] nm)
        Parses a term from the function string and returns it as a TMono object.
        Parameters:
        bf - the byte array representing the function string
        nm - the byte array representing the name string
        Returns:
        the TMono object representing the parsed term