View | Details | Raw Unified | Return to bug 77638 | Differences between
and this patch

Collapse All | Expand All

(-).classpath (-12 / +11 lines)
Lines 1-15 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
2
<classpath>
3
    <classpathentry kind="src" path="src"/>
3
	<classpathentry kind="src" path="src"/>
4
    <classpathentry kind="src" path="testsrc"/>
4
	<classpathentry kind="src" path="testsrc"/>
5
    <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
5
	<classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/>
6
    <classpathentry kind="src" path="/runtime"/>
6
	<classpathentry kind="src" path="/runtime"/>
7
    <classpathentry kind="lib" path="/lib/bcel/bcel.jar"
7
	<classpathentry kind="src" path="/util"/>
8
        rootpath="bcel-5.0/src/java" sourcepath="/lib/bcel/bcel-src.zip"/>
8
	<classpathentry kind="src" path="/testing-util"/>
9
    <classpathentry kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/src.jar"/>
9
	<classpathentry kind="src" path="/bridge"/>
10
    <classpathentry kind="src" path="/util"/>
10
	<classpathentry kind="src" path="/asm"/>
11
    <classpathentry kind="src" path="/testing-util"/>
11
	<classpathentry kind="var" path="bcel"/>
12
    <classpathentry kind="src" path="/bridge"/>
12
	<classpathentry kind="var" path="junit"/>
13
    <classpathentry kind="src" path="/asm"/>
13
	<classpathentry kind="output" path="bin"/>
14
    <classpathentry kind="output" path="bin"/>
15
</classpath>
14
</classpath>
(-)src/org/aspectj/weaver/patterns/AndPointcut.java (-6 / +66 lines)
Lines 27-56 Link Here
27
27
28
public class AndPointcut extends Pointcut {
28
public class AndPointcut extends Pointcut {
29
	Pointcut left, right;  // exposed for testing
29
	Pointcut left, right;  // exposed for testing
30
	
31
	private final boolean evaluateLeftFirst;
30
32
31
	public AndPointcut(Pointcut left, Pointcut right) {
33
	public AndPointcut(Pointcut left, Pointcut right) {
32
		super();
34
		super();
33
		this.left = left;
35
		this.left = left;
34
		this.right = right;
36
		this.right = right;
35
		setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
37
		setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
38
		//if left pc is easier to match, match this one first
39
		this.evaluateLeftFirst = this.left.matchingCosts() < this.right.matchingCosts();
36
	}
40
	}
37
41
38
	public FuzzyBoolean fastMatch(FastMatchInfo type) {
42
	public FuzzyBoolean fastMatch(FastMatchInfo type) {
39
		return left.fastMatch(type).and(right.fastMatch(type));
43
		if(this.evaluateLeftFirst) {
44
			FuzzyBoolean leftValue = left.fastMatch(type);
45
			if(leftValue.maybeTrue()) {
46
				return leftValue.and(right.fastMatch(type));
47
			} else {
48
				return leftValue;
49
			}
50
		} else {
51
			FuzzyBoolean rightValue = right.fastMatch(type);
52
			if(rightValue.maybeTrue()) {
53
				return rightValue.and(left.fastMatch(type));
54
			} else {
55
				return rightValue;
56
			}
57
		}
40
	}
58
	}
41
59
42
	public FuzzyBoolean match(Shadow shadow) {
60
	public FuzzyBoolean match(Shadow shadow) {
43
		return left.match(shadow).and(right.match(shadow));
61
		if(this.evaluateLeftFirst) {
62
			FuzzyBoolean leftValue = left.match(shadow);
63
			if(leftValue.maybeTrue()) {
64
				return leftValue.and(right.match(shadow));
65
			} else {
66
				return leftValue;
67
			}
68
		} else {
69
			FuzzyBoolean rightValue = right.match(shadow);
70
			if(rightValue.maybeTrue()) {
71
				return rightValue.and(left.match(shadow));
72
			} else {
73
				return rightValue;
74
			}
75
		}
44
	}
76
	}
45
	
77
	
46
	public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) {
78
	public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) {
47
		return left.match(jp,encJP).and(right.match(jp,encJP));
79
		if(this.evaluateLeftFirst) {
80
			FuzzyBoolean leftValue = left.match(jp,encJP);
81
			if(leftValue.maybeTrue()) {
82
				return leftValue.and(right.match(jp,encJP));
83
			} else {
84
				return leftValue;
85
			}
86
		} else {
87
			FuzzyBoolean rightValue = right.match(jp,encJP);
88
			if(rightValue.maybeTrue()) {
89
				return rightValue.and(left.match(jp,encJP));
90
			} else {
91
				return rightValue;
92
			}
93
		}
48
	}
94
	}
49
	
95
		
50
	public FuzzyBoolean match(JoinPoint.StaticPart jpsp) {
96
	public FuzzyBoolean match(JoinPoint.StaticPart jpsp) {
51
		return left.match(jpsp).and(right.match(jpsp));
97
		if(this.evaluateLeftFirst) {
98
			FuzzyBoolean leftValue = left.match(jpsp);
99
			if(leftValue.maybeTrue()) {
100
				return leftValue.and(right.match(jpsp));
101
			} else {
102
				return leftValue;
103
			}
104
		} else {
105
			FuzzyBoolean rightValue = right.match(jpsp);
106
			if(rightValue.maybeTrue()) {
107
				return rightValue.and(left.match(jpsp));
108
			} else {
109
				return rightValue;
110
			}
111
		}
52
	}
112
	}
53
	
113
		
54
	public String toString() {
114
	public String toString() {
55
		return "(" + left.toString() + " && " + right.toString() + ")";
115
		return "(" + left.toString() + " && " + right.toString() + ")";
56
	}
116
	}
(-)src/org/aspectj/weaver/patterns/OrPointcut.java (-5 / +65 lines)
Lines 28-55 Link Here
28
public class OrPointcut extends Pointcut {
28
public class OrPointcut extends Pointcut {
29
	private Pointcut left, right;
29
	private Pointcut left, right;
30
30
31
	private final boolean evaluateLeftFirst;
32
31
	public OrPointcut(Pointcut left, Pointcut right) {
33
	public OrPointcut(Pointcut left, Pointcut right) {
32
		super();
34
		super();
33
		this.left = left;
35
		this.left = left;
34
		this.right = right;
36
		this.right = right;
35
		setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
37
		setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
38
		//if left pc is easier to match, match this one first
39
		this.evaluateLeftFirst = this.left.matchingCosts() < this.right.matchingCosts();
36
	}
40
	}
37
41
38
42
39
	public FuzzyBoolean fastMatch(FastMatchInfo type) {
43
	public FuzzyBoolean fastMatch(FastMatchInfo type) {
40
		return left.fastMatch(type).or(right.fastMatch(type));
44
		if(this.evaluateLeftFirst) {
45
			FuzzyBoolean leftValue = left.fastMatch(type);
46
			if(leftValue.maybeFalse()) {
47
				return leftValue.or(right.fastMatch(type));
48
			} else {
49
				return leftValue;
50
			}
51
		} else {
52
			FuzzyBoolean rightValue = right.fastMatch(type);
53
			if(rightValue.maybeFalse()) {
54
				return rightValue.or(left.fastMatch(type));
55
			} else {
56
				return rightValue;
57
			}
58
		}
41
	}
59
	}
42
60
43
	public FuzzyBoolean match(Shadow shadow) {
61
	public FuzzyBoolean match(Shadow shadow) {
44
		return left.match(shadow).or(right.match(shadow));
62
		if(this.evaluateLeftFirst) {
63
			FuzzyBoolean leftValue = left.match(shadow);
64
			if(leftValue.maybeFalse()) {
65
				return leftValue.or(right.match(shadow));
66
			} else {
67
				return leftValue;
68
			}
69
		} else {
70
			FuzzyBoolean rightValue = right.match(shadow);
71
			if(rightValue.maybeFalse()) {
72
				return rightValue.or(left.match(shadow));
73
			} else {
74
				return rightValue;
75
			}
76
		}
45
	}
77
	}
46
	
78
	
47
	public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) {
79
	public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) {
48
		return left.match(jp,encJP).or(right.match(jp,encJP));
80
		if(this.evaluateLeftFirst) {
81
			FuzzyBoolean leftValue = left.match(jp,encJP);
82
			if(leftValue.maybeFalse()) {
83
				return leftValue.or(right.match(jp,encJP));
84
			} else {
85
				return leftValue;
86
			}
87
		} else {
88
			FuzzyBoolean rightValue = right.match(jp,encJP);
89
			if(rightValue.maybeFalse()) {
90
				return rightValue.or(left.match(jp,encJP));
91
			} else {
92
				return rightValue;
93
			}
94
		}
49
	}
95
	}
50
	
96
		
51
	public FuzzyBoolean match(JoinPoint.StaticPart jpsp) {
97
	public FuzzyBoolean match(JoinPoint.StaticPart jpsp) {
52
		return left.match(jpsp).or(right.match(jpsp));
98
		if(this.evaluateLeftFirst) {
99
			FuzzyBoolean leftValue = left.match(jpsp);
100
			if(leftValue.maybeFalse()) {
101
				return leftValue.or(right.match(jpsp));
102
			} else {
103
				return leftValue;
104
			}
105
		} else {
106
			FuzzyBoolean rightValue = right.match(jpsp);
107
			if(rightValue.maybeFalse()) {
108
				return rightValue.or(left.match(jpsp));
109
			} else {
110
				return rightValue;
111
			}
112
		}
53
	}
113
	}
54
	
114
	
55
	public String toString() {
115
	public String toString() {
(-)src/org/aspectj/weaver/patterns/Pointcut.java (-1 / +9 lines)
Lines 62-68 Link Here
62
		this.state = SYMBOLIC;
62
		this.state = SYMBOLIC;
63
	}
63
	}
64
	
64
	
65
65
	/**
66
	 * @return The approximate costs of checking for a match
67
	 * of this pointcut. This should in most cases be implemented by subclasses.
68
	 */
69
	public int matchingCosts() {
70
		return 0;
71
	}
72
	
73
	
66
	/**
74
	/**
67
	 * Could I match any shadows in the code defined within this type?
75
	 * Could I match any shadows in the code defined within this type?
68
	 */
76
	 */

Return to bug 77638