KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > prose > filter > Within


1 //
2
// This file is part of the prose package.
3
//
4
// The contents of this file are subject to the Mozilla Public License
5
// Version 1.1 (the "License"); you may not use this file except in
6
// compliance with the License. You may obtain a copy of the License at
7
// http://www.mozilla.org/MPL/
8
//
9
// Software distributed under the License is distributed on an "AS IS" basis,
10
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
// for the specific language governing rights and limitations under the
12
// License.
13
//
14
// The Original Code is prose.
15
//
16
// The Initial Developer of the Original Code is Andrei Popovici. Portions
17
// created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
18
// All Rights Reserved.
19
//
20
// Contributor(s):
21
// $Id: Within.java,v 1.1.1.1 2003/07/02 15:30:52 apopovic Exp $
22
// =====================================================================
23
//
24
// (history at end)
25
//
26

27 package ch.ethz.prose.filter;
28
29 // used packages
30
import java.util.*;
31 import java.io.*;
32 import ch.ethz.jvmai.JoinPointKinds;
33
34 /**
35  * Class Within XXX
36  *
37  * @version $Revision: 1.1.1.1 $
38  * @author Andrei Popovici
39  */

40 public
41 class Within {
42
43   public static PointCutter type(String JavaDoc regexp)
44     {
45       PointCutter t = new ExecutionsInClassFilter(regexp,ExecutionsInClassFilter.MATCH_CLASS_NAME_OPMODE);
46       t.setToString("Within.type(" + regexp + ")");
47       return t;
48     }
49
50  public static PointCutter packageTypes(String JavaDoc regexp)
51     {
52       PointCutter t = new ExecutionsInClassFilter(regexp,ExecutionsInClassFilter.MATCH_PACKAGE_NAME_OPMODE);
53       t.setToString("Within.packages(" + regexp + ")");
54       return t;
55     }
56
57   public static PointCutter type(Class JavaDoc cls)
58     {
59       PointCutter t = new ExecutionsInSubclassFilter(cls, ExecutionsInSubclassFilter.NO_INHERITANCE);
60       t.setToString("Within.type(" + cls.getName() + ")");
61       return t;
62     }
63
64   public static PointCutter type(int modifier)
65     {
66       PointCutter t = new ExecutionsAclFilter(modifier, ExecutionsAclFilter.FILTER_CLASS_MODIFIERS);
67       t.setToString("Within.type(" + modifier + ")");
68       return t;
69     }
70
71   public static PointCutter subType(Class JavaDoc cls)
72     {
73       PointCutter t = new ExecutionsInSubclassFilter(cls, ExecutionsInSubclassFilter.SUBCLASS_INHERITANCE);
74       t.setToString("Within.subType(" + cls.getName() + ")");
75       return t;
76     }
77
78
79   public static PointCutter superType(Class JavaDoc cls)
80     {
81       PointCutter t = new ExecutionsInSubclassFilter(cls, ExecutionsInSubclassFilter.SUPERCLASS_INHERITANCE);
82       t.setToString("Within.superType(" + cls.getName() + ")");
83       return t;
84     }
85
86
87   public static PointCutter method(String JavaDoc regexp)
88     {
89       PointCutter t = new ExecutionsInMethodFilter(regexp);
90       t.setToString("Within.method(" + regexp + ")");
91       return t;
92     }
93
94
95   public static PointCutter method(int modifier)
96     {
97       PointCutter t = new ExecutionsAclFilter(modifier, ExecutionsAclFilter.FILTER_METHOD_MODIFIERS);
98       t.setToString("Within.method(" + modifier + ")");
99       return t;
100     }
101
102   public static PointCutter userCode()
103     {
104       PointCutter t = new NegatingPointCutter(new ExecutionsInSystemClass());
105       t.setToString("Within.userCode()");
106       return t;
107     }
108
109   public static PointCutter systemCode()
110     {
111       PointCutter t = new ExecutionsInSystemClass();
112       t.setToString("Within.systemCode()");
113       return t;
114     }
115
116 }
117
118
119 //======================================================================
120
//
121
// $Log: Within.java,v $
122
// Revision 1.1.1.1 2003/07/02 15:30:52 apopovic
123
// Imported from ETH Zurich
124
//
125
// Revision 1.3 2003/05/25 11:46:50 popovici
126
// Improved 'toString' presentation of aspects
127
//
128
// Revision 1.2 2003/05/06 15:51:45 popovici
129
// Mozilla-ification
130
//
131
// Revision 1.1 2003/05/05 13:57:48 popovici
132
// renaming from runes to prose
133
//
134
// Revision 1.3 2003/04/27 13:08:50 popovici
135
// Specializers renamed to PointCutter
136
//
137
// Revision 1.2 2003/04/25 15:41:57 popovici
138
// Added the 'equalsTo' type filter in within
139
//
140
// Revision 1.1 2003/04/17 13:54:29 popovici
141
// Refactorization of 'ExecutionS' into 'Within' and 'Executions'.
142
// Method names refer now to 'types'
143
//
144
// Revision 1.2 2003/04/17 12:49:33 popovici
145
// Refactoring of the crosscut package
146
// ExceptionCut renamed to ThrowCut
147
// McutSignature is now SignaturePattern
148
//
149
// Revision 1.1 2003/04/17 08:47:40 popovici
150
// Important functionality additions
151
// - Cflow specializers
152
// - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
153
// - Transactional capabilities
154
// - Total refactoring of Specializer evaluation, which permits fine-grained distinction
155
// between static and dynamic specializers.
156
// - Functionality pulled up in abstract classes
157
// - Uniformization of advice methods patterns and names
158
//
159
Popular Tags