1 11 package org.eclipse.jdt.internal.compiler.impl; 12 13 public class DoubleConstant extends Constant { 14 15 private double value; 16 17 public static Constant fromValue(double value) { 18 19 return new DoubleConstant(value); 20 } 21 22 private DoubleConstant(double value) { 23 this.value = value; 24 } 25 26 public byte byteValue() { 27 return (byte) value; 28 } 29 30 public char charValue() { 31 return (char) value; 32 } 33 34 public double doubleValue() { 35 return this.value; 36 } 37 38 public float floatValue() { 39 return (float) value; 40 } 41 42 public int intValue() { 43 return (int) value; 44 } 45 46 public long longValue() { 47 return (long) value; 48 } 49 50 public short shortValue() { 51 return (short) value; 52 } 53 54 public String stringValue() { 55 return String.valueOf(this.value); 56 } 57 58 public String toString() { 59 if (this == NotAConstant) 60 return "(Constant) NotAConstant"; return "(double)" + value; } 63 64 public int typeID() { 65 return T_double; 66 } 67 } 68 | Popular Tags |