Package parser
Class Number
java.lang.Object
parser.Number
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getIndex()
getNum()
static boolean
isNegative
(String num) 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,Operator objects e.t.cstatic void
void
setIndex
(int index) void
void
validateNumber
(MathExpression function) static boolean
validNumber
(String num) This method may be used to test strings to see if or not they represent valid numbers.
-
Field Details
-
num
The string of digits that represent this Number object. -
index
private int indexThe location of the Number in the scanner output of the parent MathExpression object that contains this Number object.
-
-
Constructor Details
-
Number
- Parameters:
num
- The string of digits that represent this Number object.
-
Number
- 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
- Parameters:
num
- sets the string of digits that represent this Number object.
-
getNum
- Returns:
- the string of digits that represent this Number object.
-
validNumber
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
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
-
getNumber
-
validateNumber
-
main
-