KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.aspectj.compiler.base.ast.*;
27 import org.aspectj.compiler.crosscuts.joinpoints.*;
28
29 import org.aspectj.compiler.base.JavaCompiler;
30
31 import java.util.*;
32 import org.aspectj.util.FuzzyBoolean;
33
34 /**
35  * @grammar !name
36  * @child GenTypeName name
37  */

38
39 public class ComplementTypeName extends GenTypeName {
40     public String JavaDoc toShortString() {
41         return "!" + name.toShortString();
42     }
43     
44     public boolean matches(Type type) {
45         return !name.matches(type);
46     }
47     public FuzzyBoolean matchesInstance(Type type) {
48         return name.matchesInstance(type).not();
49     }
50     
51     public JpPlan makePlan(JoinPoint jp, Expr expr) {
52         JpPlan plan = name.makePlan(jp, expr);
53         return plan.not();
54     }
55     
56     //BEGIN: Generated from @child and @property
57
protected GenTypeName name;
58     public GenTypeName getName() { return name; }
59     public void setName(GenTypeName _name) {
60         if (_name != null) _name.setParent(this);
61         name = _name;
62     }
63     
64     public ComplementTypeName(SourceLocation location, GenTypeName _name) {
65         super(location);
66         setName(_name);
67     }
68     protected ComplementTypeName(SourceLocation source) {
69         super(source);
70     }
71     
72     public ASTObject copyWalk(CopyWalker walker) {
73         ComplementTypeName ret = new ComplementTypeName(getSourceLocation());
74         ret.preCopy(walker, this);
75         if (name != null) ret.setName( (GenTypeName)walker.process(name) );
76         return ret;
77     }
78     
79     public ASTObject getChildAt(int childIndex) {
80         switch(childIndex) {
81         case 0: return name;
82         default: return super.getChildAt(childIndex);
83         }
84     }
85      public String JavaDoc getChildNameAt(int childIndex) {
86         switch(childIndex) {
87         case 0: return "name";
88         default: return super.getChildNameAt(childIndex);
89         }
90     }
91      public void setChildAt(int childIndex, ASTObject child) {
92         switch(childIndex) {
93         case 0: setName((GenTypeName)child); return;
94         default: super.setChildAt(childIndex, child); return;
95         }
96     }
97      public int getChildCount() {
98         return 1;
99     }
100     
101     public String JavaDoc getDefaultDisplayName() {
102         return "ComplementTypeName()";
103     }
104     
105     //END: Generated from @child and @property
106
}
107
108
Popular Tags