KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > compiler > base > ast > LongLiteralExpr


1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the compiler and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  *
22  * Contributor(s):
23  */

24
25 package org.aspectj.compiler.base.ast;
26
27 import org.aspectj.compiler.base.JavaCompiler;
28
29 import org.aspectj.compiler.base.bcg.FieldBuilder;
30 import org.aspectj.compiler.base.bcg.CodeBuilder;
31 import org.aspectj.compiler.base.bcg.Label;
32
33 /**
34   * @grammar longLiteral
35   * @property long longValue
36   */

37 public class LongLiteralExpr extends NumericLiteralExpr {
38
39     public int getIntValue() { return (int)longValue; }
40     public float getFloatValue() { return (float)longValue; }
41     public double getDoubleValue() { return (double)longValue; }
42     public String JavaDoc getStringValue() { return "" + longValue; }
43
44     public LongLiteralExpr(SourceLocation location, long _longValue) {
45         this(location, location.getCompiler().getTypeManager().longType, _longValue + "L", _longValue);
46     }
47
48     // ------------------------------
49
// bcg
50
protected void cgValue(CodeBuilder cb) {
51         cb.emitLongConstant(longValue);
52     }
53     public void addConstant(FieldBuilder fb) {
54         fb.setConstantValue(longValue);
55     }
56     public boolean isConstantZero() { return longValue == 0L; }
57
58     //BEGIN: Generated from @child and @property
59
protected long longValue;
60     public long getLongValue() { return longValue; }
61     public void setLongValue(long _longValue) { longValue = _longValue; }
62
63     public LongLiteralExpr(SourceLocation location, Type _type, String JavaDoc _value, long _longValue) {
64         super(location, _type, _value);
65         setLongValue(_longValue);
66     }
67     protected LongLiteralExpr(SourceLocation source) {
68         super(source);
69     }
70
71     public ASTObject copyWalk(CopyWalker walker) {
72         LongLiteralExpr ret = new LongLiteralExpr(getSourceLocation());
73         ret.preCopy(walker, this);
74         ret.type = type;
75         ret.value = value;
76         ret.longValue = longValue;
77         return ret;
78     }
79
80
81     public String JavaDoc getDefaultDisplayName() {
82         return "LongLiteralExpr(type: "+type+", "+"value: "+value+", "+"longValue: "+longValue+")";
83     }
84
85     //END: Generated from @child and @property
86
}
87
Popular Tags