bc3e3454cc90fc4a34265987efd8c8b900c168d2
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / impl / ByteConstant.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v0.5 
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v05.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.impl;
12
13 public class ByteConstant extends Constant {
14         byte value;
15 public ByteConstant(byte value) {
16         this.value = value;
17 }
18 public byte byteValue() {
19         return (byte) value;
20 }
21 public char charValue() {
22         return (char) value;
23 }
24 public double doubleValue() {
25         return (double) value;
26 }
27 public float floatValue() {
28         return (float) value;
29 }
30 public int intValue() {
31         return (int) value;
32 }
33 public long longValue() {
34         return (long) value;
35 }
36 public short shortValue() {
37         return (short) value;
38 }
39 public String stringValue() {
40         //spec 15.17.11
41         
42         String s = new Integer(value).toString() ;
43         if (s == null)
44                 return "null"; //$NON-NLS-1$
45         else
46                 return s;
47 }
48 public String toString(){
49
50         return "(byte)" + value ; } //$NON-NLS-1$
51 public int typeID() {
52         return T_byte;
53 }
54 }