hussam.math.operations
Class Constant

java.lang.Object
extended by hussam.math.operations.Variable
extended by 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.
 
Method Summary
 voidsetOperation(Operation o)
          This will throw a Runtime Exception.
 
Methods inherited from class hussam.math.operations.Variable
getName, result, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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.
Method Detail

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.