MVT API

math.constants
Class IntegerConstant

java.lang.Object
  |
  +--math.objects.Expression
        |
        +--math.objects.Constant
              |
              +--math.constants.IntegerConstant

public class IntegerConstant
extends Constant

The class Constant is used to create mathematical Constant objects. It extends the Expression class.

Since:
JDK1.1
Author:
Peter Staab
, Pete Fox , both for the Mathematical Visualization Project for the Department of Applied Mathematics, University of Colorado at Boulder

Constructor Summary
IntegerConstant(IntegerConstant value)
          Copy constructor to create new integer constant.
IntegerConstant(long value)
          Constructor to create a new integer constant.
 
Method Summary
 java.lang.Object clone()
          Create a copy of this.
 boolean equals(java.lang.Object o)
          Checks to see if the objects are equal.
 double evaluate(VariableSet vars, double[] values)
          A method used to evaluate a Constant object given an ordered variable vector and a corresponding array of constant double values
 Expression evaluateVariables(VariableSet variables, double[] values)
          A method used to evaluate a Constant object containing multiple variables given only one variable name and one value
 long getValue()
          Returns the integer that this represenets.
 java.lang.String toString()
          Overrides the toString() method of the Object class.
 
Methods inherited from class math.objects.Constant
differentiate, simplify
 
Methods inherited from class math.objects.Expression
evaluate, evaluate, evaluate, evaluate, evaluate
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerConstant

public IntegerConstant(long value)
Constructor to create a new integer constant.

Parameters:
value - the Constant will represent

IntegerConstant

public IntegerConstant(IntegerConstant value)
Copy constructor to create new integer constant.

Parameters:
value - the new constant for this.
Method Detail

clone

public java.lang.Object clone()
Create a copy of this.

Overrides:
clone in class java.lang.Object
Returns:
Object of type IntegerConstant.

equals

public boolean equals(java.lang.Object o)
Checks to see if the objects are equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare this to.
Returns:
true if o is an IntegerConstant and is equal to this, otherwise false is returned.

getValue

public long getValue()
Returns the integer that this represenets.

Returns:
the integer value of this.

toString

public java.lang.String toString()
Overrides the toString() method of the Object class. This gives a string represenation of the Symbolic Object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the Constant Object

evaluate

public double evaluate(VariableSet vars,
                       double[] values)
                throws java.lang.ArithmeticException,
                       VariableUndefinedException,
                       IllegalEvaluationException
A method used to evaluate a Constant object given an ordered variable vector and a corresponding array of constant double values

Specified by:
evaluate in class Expression
Parameters:
vars - the name of the VariableVector of Variables associated with the function.
Returns:
a double representing the value of the Expression for the entered value.
Throws:
VariableUndefinedException - for Variables not defined
java.lang.ArithmeticException - for NaN and Divide by Zero
IllegalEvaluationException - if an error occurs

evaluateVariables

public Expression evaluateVariables(VariableSet variables,
                                    double[] values)
                             throws java.lang.ArithmeticException,
                                    IllegalEvaluationException
A method used to evaluate a Constant object containing multiple variables given only one variable name and one value

Specified by:
evaluateVariables in class Expression
Parameters:
variables - a VariableSet value
values - a double[] value
Returns:
a Expression object representing the given Expression with one of it's variables evaluated for the given value.
Throws:
java.lang.ArithmeticException - for NaN and Divide by Zero
IllegalEvaluationException - if an error occurs

MVT API

mvt.icons