Package math.differentialcalculus
Class Utilities
java.lang.Object
math.differentialcalculus.Utilities
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
evaluateTokens
(ArrayList<String> scan) Evaluates products of numbers or divisions of numbers.static void
freeSpaces
(List<String> scan) static String
static boolean
isAutoGenNameFormat
(String name) static boolean
isDifferentiable
(String value) static boolean
static void
static void
static void
void
openBrackets
(ArrayList<String> scan) Checks for the pattern..static void
static void
Simplifies portions of math code that involve products or quotients of -1.private static void
simplifyOneProducts
(int index, ArrayList<String> list) static void
simplifyOneProducts
(ArrayList<String> list) static void
simplifyZeroes
(ArrayList<String> array) static void
simplifyZeroesAt
(int index, ArrayList<String> list) static void
tokenRearranger
(ArrayList<String> scan) Condenses numbers and variables to be added within a bracket to the end of the bracket.
-
Field Details
-
whitespaceremover
-
-
Constructor Details
-
Utilities
public Utilities()
-
-
Method Details
-
freeSpaces
-
print
-
isAutoGenNameFormat
- Parameters:
name
- The name to check.- Returns:
- true if the name is automatically generated and so, most likely refers to a stored Differentiable.
-
getText
- Parameters:
data
- An ArrayList of Strings. return the Strings in the List concatenated together.
-
isDifferentiable
- Parameters:
value
- The item to check Always double check in the scanner where this item exists that the next token tovalue
is not an open bracket if value is a valid variable name.- Returns:
- true if it can be differentiated to get a value.
-
isFormula
-
simplifyNegOneProducts
Simplifies portions of math code that involve products or quotients of -1.- Parameters:
list
- The list of math tokens.
-
simplifyZeroes
- Parameters:
array
- The scanned list containing math tokens. This method seeks to apply the algebraic effect of adding or subtracting or multiplying zeroes to a math expression. e.g. 3*x*0+4*1 becomes 4*1.
-
simplifyZeroesAt
- Parameters:
index
- The index at which the zero is.list
- The scanned list containing math tokens. Method that recursively applies the effect of zero at its point of occurrence to a math expression.
-
simplifyOneProducts
- Parameters:
index
- The index of the 1list
- The ArrayList containing it. Seeks to calculate the effect of multiplying 1 with quantities in the list...e.g 1*(....) becomes (.....), 1*sin(...) becomes sin(...)
-
simplifyOneProducts
- Parameters:
list
- The ArrayList containing it. Seeks to calculate the effect of multiplying 1 with quantities in the list...e.g 1*(....) becomes (.....), 1*sin(...) becomes sin(...)
-
openBrackets
Checks for the pattern.. ...+,(,.......,)+|- and removes the bracket..if possible.- Parameters:
scan
- The list of math tokens
-
evaluateTokens
Evaluates products of numbers or divisions of numbers.- Parameters:
scan
- The scanner output.
-
tokenRearranger
Condenses numbers and variables to be added within a bracket to the end of the bracket. For instance,(3+x+sin(3*x)+5-7) becomes (sin(3*x)+3+x-2)- Parameters:
scan
- The scanner output.
-
multipleBracketRemover
- Parameters:
list
- The list containing the scanned math tokens.
-
multipleBracketRemover_
- Parameters:
list
- The list containing the scanned math tokens.
-
main
-