Class MNumber

java.lang.Object
math.matrix.expressParser.MNumber

public class MNumber extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
    The location of the MNumber in the scanner output of the parent Function object that contains this MNumber object.
    private String
    The string of digits that represent this MNumber object.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    MNumber(String num, int index, ArrayList<String> scan)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
     
     
    boolean
     
    boolean
    Built for use in my parser only.Serves to detect already and properly scanned numbers in the list where string models of other objects reside, e.g Variable objects,MOperator objects e.t.c It is a short cut method that allows for lightning number detection in an environment that contains numbers and other objects like variables, operators e.t.c as it does away with matching patterns and tests just a maximum of 2 numbers to know if the object is a number or not.
    static boolean
    Built for use in my parser only.Serves to detect already and properly scanned numbers in the list where string models of other objects reside, e.g Variable objects,MOperator objects e.t.c
    static void
    main(String[] args)
     
    void
    setIndex(int index)
     
    void
     
    void
     
    static boolean
    This method may be used to test strings to see if or not they represent valid numbers.

    Methods inherited from class java.lang.Object

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

    • num

      private String num
      The string of digits that represent this MNumber object.
    • index

      private int index
      The location of the MNumber in the scanner output of the parent Function object that contains this MNumber object.
  • Constructor Details

    • MNumber

      public MNumber(String num)
      Parameters:
      num - The string of digits that represent this MNumber object.
    • MNumber

      public MNumber(String num, int index, ArrayList<String> scan)
      Parameters:
      num - The string of digits that represent this MNumber object.
      index - the location of this MOperator object in its parent Function object's scanned ArrayList object.
      scan - The scanner output
  • Method Details

    • setIndex

      public void setIndex(int index)
      Parameters:
      index - sets the location of this MOperator object in its parent Function
    • getIndex

      public int getIndex()
      Returns:
      the location of this MOperator object in its parent Function
    • setNum

      public void setNum(String num)
      Parameters:
      num - sets the string of digits that represent this MNumber object.
    • getNum

      public String getNum()
      Returns:
      the string of digits that represent this MNumber object.
    • isNumber

      public boolean isNumber()
      Built for use in my parser only.Serves to detect already and properly scanned numbers in the list where string models of other objects reside, e.g Variable objects,MOperator objects e.t.c It is a short cut method that allows for lightning number detection in an environment that contains numbers and other objects like variables, operators e.t.c as it does away with matching patterns and tests just a maximum of 2 numbers to know if the object is a number or not.
      Returns:
      true if the item is a number
    • validNumber

      public static boolean validNumber(String num)
      This method may be used to test strings to see if or not they represent valid numbers.
      Parameters:
      num - The string to test.
      Returns:
      true if the string is a valid number
    • isNumber

      public static boolean isNumber(String num)
      Built for use in my parser only.Serves to detect already and properly scanned numbers in the list where string models of other objects reside, e.g Variable objects,MOperator objects e.t.c
      Parameters:
      num - the string to be checked if it is a number or not
      Returns:
      true if the item is a number
    • isNegative

      public boolean isNegative()
      Returns:
      true if this MNumber object is a negative one.
    • getNumber

      public MNumber getNumber()
    • validateNumber

      public void validateNumber(MatrixFunction function)
    • main

      public static void main(String[] args)