/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ /** * eine Klasse fuer Konstanten * */ //-------------------- public class Const extends Expr { protected Object value; //-------------------- public Const(Object value) { this.value = value; } //-------------------- // ein spezieller Konstruktor // fuer die einfachere Behandlung von int Werten public Const(int value) { this(new Integer(value)); } //-------------------- // ein spezieller Konstruktor // fuer die einfachere Behandlung von double Werten public Const(double value) { this(new Double(value)); } //-------------------- public Object eval() { return value; } //-------------------- public String toString() { return value.toString(); } } //--------------------