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