1 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 38 39 public class ComplementTypeName extends GenTypeName { 40 public String 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 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 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 getDefaultDisplayName() { 102 return "ComplementTypeName()"; 103 } 104 105 } 107 108 | Popular Tags |