volodymyrkutsenko / betterbrain

1 stars 0 forks source link

Change SimpleArithmeticEquation to calculate the result and toString value only once during it's creation #11

Closed volodymyrkutsenko closed 10 years ago

volodymyrkutsenko commented 10 years ago

Now SimpleArithmeticEquation getResult() method always calculates the result on its call

Since SimpleArithmeticEquation is an immutable object -- the result cannot change therefore SimpleArithmeticEquation should calculate the result on its creation and getResult() should always return this calculated result.

The same should be done for toString() value