/** * 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. */ public class IntToDouble extends UnaryExpr { //-------------------- public IntToDouble(Expr operand) { super(operand); } //-------------------- // Konversion nach double protected Object op1(Object v1) { // int to double Konversion if ( v1 instanceof Integer ) { return new Double( ((Integer)v1).doubleValue() ); } // nicht erlaubtes Argument throw new IllegalArgumentException("int to double: illegal operand type"); } //-------------------- public String op1ToString() { return "(double)"; } }