edu.hws.jcm.data
Class Cases
java.lang.Object
|
+--edu.hws.jcm.data.Cases
- public class Cases
- extends java.lang.Object
An object of type Cases stores a list of "case values" that is generated
while an expression is being evaluated using the routine Expression.getValuesWithCases().
This information can be used as a heuristic (i.e. a fudge) to help detect
a possible discontinuity between two evaluations of the expression. Suppose
that the expression is evaluated twice, with some change of variable values
between the two evaluations. If the variables' values are not changed too much,
and if the Cases objects generated by the two evaluations are equal (as determined
by the "equals" method defined in this class), then it is likely that
there is no discontinuity. (However, this is not perfect. The discontinuity
in 1/x^2 won't be detected since the case value generated by 1/f(x) only
checks the sign of f(x), and the denominator of 1/x^2 is positive on both
sides of x=0. If you want to be more paranoid, check both the expression
and its derivative.) (I really don't like this very much, but it can be used to draw
pretty good graphs in general.)
Constructor Summary |
Cases()
|
Method Summary |
void |
addCase(int value)
Add a new case value to the list stored in this object. |
void |
clear()
Remove all the cases that have been added with addCase(). |
boolean |
equals(Cases c)
Test whether c contains exactly the same list of case
values as this Cases object does. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Cases
public Cases()
clear
public void clear()
- Remove all the cases that have been added with addCase().
This makes it possible to reuse this object in another
call to Expression.getValueWithCases().
addCase
public void addCase(int value)
- Add a new case value to the list stored in this object.
equals
public boolean equals(Cases c)
- Test whether c contains exactly the same list of case
values as this Cases object does.