Package parser

Class Number

java.lang.Object
parser.Number

public class Number
extends java.lang.Object
Author:
GBENRO
  • Constructor Summary

    Constructors 
    Constructor Description
    Number​(java.lang.String num)  
    Number​(java.lang.String num, int index, java.util.ArrayList<java.lang.String> scan)  
  • Method Summary

    Modifier and Type Method Description
    int getIndex()  
    java.lang.String getNum()  
    Number getNumber()  
    static boolean isNegative​(java.lang.String num)  
    static boolean isNumber​(java.lang.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,Operator objects e.t.c
    static void main​(java.lang.String[] args)  
    void setIndex​(int index)  
    void setNum​(java.lang.String num)  
    void validateNumber​(MathExpression function)  
    static boolean validNumber​(java.lang.String num)
    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
  • Constructor Details

    • Number

      public Number​(java.lang.String num)
      Parameters:
      num - The string of digits that represent this Number object.
    • Number

      public Number​(java.lang.String num, int index, java.util.ArrayList<java.lang.String> scan)
      Parameters:
      num - The string of digits that represent this Number object.
      index - the location of this Operator object in its parent MathExpression object's scanned ArrayList object.
  • Method Details

    • setIndex

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

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

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

      public java.lang.String getNum()
      Returns:
      the string of digits that represent this Number object.
    • validNumber

      public static boolean validNumber​(java.lang.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​(java.lang.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,Operator 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 static boolean isNegative​(java.lang.String num)
    • getNumber

      public Number getNumber()
    • validateNumber

      public void validateNumber​(MathExpression function)
    • main

      public static void main​(java.lang.String[] args)