hussam.math.operations
Class Constant
java.lang.Object
hussam.math.operations.Variable
hussam.math.operations.Constant
- All Implemented Interfaces:
- Operation
public final class Constant
- extends Variable
This is an Operation that simulates a constant number.
A Constant Functions as a variable, however, you cannot change
the value once it is set!
If you try to change the value, a Runtime Exception will be thrown.
To make sure that the class functions correctly, it is declared final.
- Author:
- Hussam Al-Mulhim حسام الملحم
| Constructor Summary |
|---|
Constant(java.lang.String name, Operation o) Constructs a new Constant with a name and an Operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constant
public Constant(java.lang.String name,
Operation o)
Constructs a new Constant with a name and an Operation.
- Parameters:
name - The name of the Variable.o - The operation used to get the value for that Constant.
setOperation
public void setOperation(Operation o)
This will throw a Runtime Exception.
- Overrides:
setOperation in class Variable
- Parameters:
o - The Operation to be set. This method is used to override the method in Variable, so that it would throw a Runtime Exception.