package gve.calc.formula;

import java.awt.*;

@version 28 Sep 1997 @author Geert Vernaeve
public class Real extends StaticString { // if string == null, then the doubleValue is valid. // if string != null, then the doubleValue is invalid. public double doubleValue; public String getName() { return ""+doubleValue; } public Real(double value) { doubleValue = value; } public Object clone() { return new Real(doubleValue); }
All Real objects returned by evaluate() should have a valid doubleValue field. Since all objects returned by evaluate() may be modified on the fly, we should create a copy of this Real. This is not very efficient, certainly not when plotting functions.
public Part evaluate(Evaluator ev) { return new Real(getDoubleValue()); } public double getDoubleValue() { return doubleValue; } // PENDING: A Real can be equal to an Interval of type [a,a] public boolean same(Object o) { if (!(o instanceof Real)) return false; Real r = (Real)o; return r.getDoubleValue() == getDoubleValue(); } public String toString() { return "Real["+doubleValue+"]"; } }