Class FormulaManager
java.lang.Object
math.differentialcalculus.FormulaManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
clearAll()
Object[]
comparisonData
(List<String> data) THIS UTILITY METHOD CAN BE USED TO COMPARE THE DATA OF A FORMULA OBJECT WITH OTHER FORMULAE IN THE STORE TO SEE IF A FORMULA WITH SIMILAR DATA EXISTS ALREADY.boolean
int
count()
void
Removes a Formula object from this FormulaManager.getFormula
(int index) getFormula
(String name) int
Attempts to retrieve a Formula object from a FormulaManager based on its name.int
It updates the name of a Formula object in this FormulaManager with the parameternewName
.int
Updates a Formula object in this FormulaManager.
-
Field Details
-
FORMULAE
-
-
Constructor Details
-
FormulaManager
public FormulaManager()
-
-
Method Details
-
getFORMULAE
-
count
public int count()- Returns:
- The number of Formula objects stored by an object of this class.
-
contains
- Parameters:
name
- The name of the Formula.- Returns:
- true if a Formula exists by the name supplied.
-
comparisonData
THIS UTILITY METHOD CAN BE USED TO COMPARE THE DATA OF A FORMULA OBJECT WITH OTHER FORMULAE IN THE STORE TO SEE IF A FORMULA WITH SIMILAR DATA EXISTS ALREADY. ALSO, THE COMPARISON RETURNS MULTIPLE INFORMATION, NOT JUST ONE.- Parameters:
data
- The data of the Formula.- Returns:
- an array having 3 entries. Index 0 contains 0 if a comparable Formula is found in the store. A comparable Formula is one that is either a constant factor of this one or is equivalent to this one...i.e. they evaluate to the same number, always. If index 0 contains -1, then no comparable Formula exists in the store and so indices 1 and 2 will also be -1. Index 1 contains the index at which the comparable Formula is found. Index 2 contains the factor. If factor =1 , then they are equivalent, else,they are constant factors of each other.
-
indexOf
- Parameters:
name
- The name of the dependent variable of the Formula.- Returns:
- the index of the Formula object that has the name supplied. If no such Formula object exists, then it returns -1.
-
getFormula
- Parameters:
name
- The name of the Formula.- Returns:
- the Formula object that has the name supplied if it exists. If no such Formula object exists, then it returns null.
- Throws:
ClassNotFoundException
- if no Formula object by that name exists.
-
getFormula
- Parameters:
index
- The index of the Formula in this FormulaManager object. If no such index exists, then it returns null.- Throws:
ClassNotFoundException
- if no Formula object by that name exists.
-
lookUp
-
add
- Parameters:
form
- The Formula object to add to this object.
-
delete
Removes a Formula object from this FormulaManager. -
firstFormula
-
lastFormula
-
update
It updates the name of a Formula object in this FormulaManager with the parameternewName
.- Parameters:
name
- The name of the Formula in this FormulaManager that we wish to update.newName
- The new name to give the Formula.- Returns:
- The index of the object, if a Formula by that
name is already recorded in the FormulaManager and
-1
the Formula is not found.
-
update
Updates a Formula object in this FormulaManager.- Parameters:
name
- The name of the Formula object to be updated.data
- The data to be used to update the object if found.- Returns:
- The index of the object, if a Formula by that
name is already recorded in the FormulaManager and
-1
the Formula is not found.
-
clearAll
public void clearAll()
-