diff options
author | aclement <aclement> | 2010-05-18 16:20:12 +0000 |
---|---|---|
committer | aclement <aclement> | 2010-05-18 16:20:12 +0000 |
commit | f4b1f8502f3a64c01374d15e4bf2c2830503c55b (patch) | |
tree | 210765f5943cbdfa0daf727a7790c9a5f23c938a /org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java | |
parent | 3b76e3c76c7518fe2ce1bb97a8201f08e5ef9382 (diff) | |
download | aspectj-f4b1f8502f3a64c01374d15e4bf2c2830503c55b.tar.gz aspectj-f4b1f8502f3a64c01374d15e4bf2c2830503c55b.zip |
change all relevant DataOutputStream usage to use CompressingDataOutputStream
Diffstat (limited to 'org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java')
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java | 75 |
1 files changed, 39 insertions, 36 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java index 4a131c9a8..09ce1f6d8 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java @@ -10,14 +10,13 @@ * PARC initial implementation * ******************************************************************/ - package org.aspectj.weaver.patterns; -import java.io.DataOutputStream; import java.io.IOException; import java.util.Map; import org.aspectj.util.FuzzyBoolean; +import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.ResolvedType; @@ -28,28 +27,31 @@ import org.aspectj.weaver.ast.Test; public class NotPointcut extends Pointcut { private Pointcut body; + public NotPointcut(Pointcut negated) { super(); this.body = negated; this.pointcutKind = NOT; - setLocation(negated.getSourceContext(), negated.getStart(),negated.getEnd()); // should that be at least start-1? + setLocation(negated.getSourceContext(), negated.getStart(), negated.getEnd()); // should that be at least start-1? } public NotPointcut(Pointcut pointcut, int startPos) { this(pointcut); - setLocation(pointcut.getSourceContext(), startPos, pointcut.getEnd()); + setLocation(pointcut.getSourceContext(), startPos, pointcut.getEnd()); } public int couldMatchKinds() { return Shadow.ALL_SHADOW_KINDS_BITS; } - - public Pointcut getNegatedPointcut() { return body; } + + public Pointcut getNegatedPointcut() { + return body; + } public FuzzyBoolean fastMatch(FastMatchInfo type) { return body.fastMatch(type).not(); } - + protected FuzzyBoolean matchInternal(Shadow shadow) { return body.match(shadow).not(); } @@ -58,36 +60,37 @@ public class NotPointcut extends Pointcut { return "!" + body.toString(); } - - public boolean equals(Object other) { - if (!(other instanceof NotPointcut)) return false; - NotPointcut o = (NotPointcut)other; + + public boolean equals(Object other) { + if (!(other instanceof NotPointcut)) { + return false; + } + NotPointcut o = (NotPointcut) other; return o.body.equals(body); } - public int hashCode() { - return 37*23 + body.hashCode(); - } + public int hashCode() { + return 37 * 23 + body.hashCode(); + } public void resolveBindings(IScope scope, Bindings bindings) { - //Bindings old = bindings.copy(); - - //Bindings newBindings = new Bindings(bindings.size()); - - + // Bindings old = bindings.copy(); + + // Bindings newBindings = new Bindings(bindings.size()); + body.resolveBindings(scope, null); - - //newBindings.checkEmpty(scope, "negation does not allow binding"); - //bindings.checkEquals(old, scope); - + + // newBindings.checkEmpty(scope, "negation does not allow binding"); + // bindings.checkEquals(old, scope); + } - - public void write(DataOutputStream s) throws IOException { + + public void write(CompressingDataOutputStream s) throws IOException { s.writeByte(Pointcut.NOT); body.write(s); writeLocation(s); } - + public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException { NotPointcut ret = new NotPointcut(Pointcut.read(s, context)); ret.readLocation(context, s); @@ -97,26 +100,26 @@ public class NotPointcut extends Pointcut { protected Test findResidueInternal(Shadow shadow, ExposedState state) { return Test.makeNot(body.findResidue(shadow, state)); } - + public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) { Pointcut ret = new NotPointcut(body.concretize(inAspect, declaringType, bindings)); ret.copyLocationFrom(this); return ret; } - - public Pointcut parameterizeWith(Map typeVariableMap,World w) { - Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap,w)); + + public Pointcut parameterizeWith(Map typeVariableMap, World w) { + Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap, w)); ret.copyLocationFrom(this); return ret; } - public Object accept(PatternNodeVisitor visitor, Object data) { - return visitor.visit(this, data); - } - + public Object accept(PatternNodeVisitor visitor, Object data) { + return visitor.visit(this, data); + } + public Object traverse(PatternNodeVisitor visitor, Object data) { - Object ret = accept(visitor,data); - this.body.traverse(visitor,ret); + Object ret = accept(visitor, data); + this.body.traverse(visitor, ret); return ret; } |