KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > compiler > crosscuts > ast > BinaryPcd


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.crosscuts.ast;
26
27 import org.aspectj.compiler.base.ast.*;
28 import org.aspectj.compiler.base.JavaCompiler;
29 /**
30  * @grammar pcd1 ? pcd2
31  * @child Pcd pcd1
32  * @child Pcd pcd2
33  */

34
35 public abstract class BinaryPcd extends Pcd {
36     abstract protected String JavaDoc getSymbol();
37
38     public String JavaDoc toShortString() {
39         return getPcd1().toShortString() + " " + getSymbol() + " " +
40                 getPcd2().toShortString();
41     }
42
43     public void checkStatic() { getPcd1().checkStatic(); getPcd2().checkStatic(); }
44     
45 // public boolean isAbstract(PlanData planData) {
46
// return getPcd1().isAbstract(planData) || getPcd2().isAbstract(planData);
47
// }
48

49     //BEGIN: Generated from @child and @property
50
protected Pcd pcd1;
51     public Pcd getPcd1() { return pcd1; }
52     public void setPcd1(Pcd _pcd1) {
53         if (_pcd1 != null) _pcd1.setParent(this);
54         pcd1 = _pcd1;
55     }
56     
57     protected Pcd pcd2;
58     public Pcd getPcd2() { return pcd2; }
59     public void setPcd2(Pcd _pcd2) {
60         if (_pcd2 != null) _pcd2.setParent(this);
61         pcd2 = _pcd2;
62     }
63     
64     public BinaryPcd(SourceLocation location, Pcd _pcd1, Pcd _pcd2) {
65         super(location);
66         setPcd1(_pcd1);
67         setPcd2(_pcd2);
68     }
69     protected BinaryPcd(SourceLocation source) {
70         super(source);
71     }
72     
73     public ASTObject getChildAt(int childIndex) {
74         switch(childIndex) {
75         case 0: return pcd1;
76         case 1: return pcd2;
77         default: return super.getChildAt(childIndex);
78         }
79     }
80      public String JavaDoc getChildNameAt(int childIndex) {
81         switch(childIndex) {
82         case 0: return "pcd1";
83         case 1: return "pcd2";
84         default: return super.getChildNameAt(childIndex);
85         }
86     }
87      public void setChildAt(int childIndex, ASTObject child) {
88         switch(childIndex) {
89         case 0: setPcd1((Pcd)child); return;
90         case 1: setPcd2((Pcd)child); return;
91         default: super.setChildAt(childIndex, child); return;
92         }
93     }
94      public int getChildCount() {
95         return 2;
96     }
97     
98     public String JavaDoc getDefaultDisplayName() {
99         return "BinaryPcd()";
100     }
101     
102     //END: Generated from @child and @property
103
}
104
Popular Tags