001: //
002: // This file is part of the prose package.
003: //
004: // The contents of this file are subject to the Mozilla Public License
005: // Version 1.1 (the "License"); you may not use this file except in
006: // compliance with the License. You may obtain a copy of the License at
007: // http://www.mozilla.org/MPL/
008: //
009: // Software distributed under the License is distributed on an "AS IS" basis,
010: // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011: // for the specific language governing rights and limitations under the
012: // License.
013: //
014: // The Original Code is prose.
015: //
016: // The Initial Developer of the Original Code is Andrei Popovici. Portions
017: // created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
018: // All Rights Reserved.
019: //
020: // Contributor(s):
021: // $Id: Within.java,v 1.1.1.1 2003/07/02 15:30:52 apopovic Exp $
022: // =====================================================================
023: //
024: // (history at end)
025: //
026:
027: package ch.ethz.prose.filter;
028:
029: /**
030: * Class Within XXX
031: *
032: * @version $Revision: 1.1.1.1 $
033: * @author Andrei Popovici
034: */
035: public class Within {
036:
037: public static PointCutter type(String regexp) {
038: PointCutter t = new ExecutionsInClassFilter(regexp,
039: ExecutionsInClassFilter.MATCH_CLASS_NAME_OPMODE);
040: t.setToString("Within.type(" + regexp + ")");
041: return t;
042: }
043:
044: public static PointCutter packageTypes(String regexp) {
045: PointCutter t = new ExecutionsInClassFilter(regexp,
046: ExecutionsInClassFilter.MATCH_PACKAGE_NAME_OPMODE);
047: t.setToString("Within.packages(" + regexp + ")");
048: return t;
049: }
050:
051: public static PointCutter type(Class cls) {
052: PointCutter t = new ExecutionsInSubclassFilter(cls,
053: ExecutionsInSubclassFilter.NO_INHERITANCE);
054: t.setToString("Within.type(" + cls.getName() + ")");
055: return t;
056: }
057:
058: public static PointCutter type(int modifier) {
059: PointCutter t = new ExecutionsAclFilter(modifier,
060: ExecutionsAclFilter.FILTER_CLASS_MODIFIERS);
061: t.setToString("Within.type(" + modifier + ")");
062: return t;
063: }
064:
065: public static PointCutter subType(Class cls) {
066: PointCutter t = new ExecutionsInSubclassFilter(cls,
067: ExecutionsInSubclassFilter.SUBCLASS_INHERITANCE);
068: t.setToString("Within.subType(" + cls.getName() + ")");
069: return t;
070: }
071:
072: public static PointCutter super Type(Class cls) {
073: PointCutter t = new ExecutionsInSubclassFilter(cls,
074: ExecutionsInSubclassFilter.SUPERCLASS_INHERITANCE);
075: t.setToString("Within.superType(" + cls.getName() + ")");
076: return t;
077: }
078:
079: public static PointCutter method(String regexp) {
080: PointCutter t = new ExecutionsInMethodFilter(regexp);
081: t.setToString("Within.method(" + regexp + ")");
082: return t;
083: }
084:
085: public static PointCutter method(int modifier) {
086: PointCutter t = new ExecutionsAclFilter(modifier,
087: ExecutionsAclFilter.FILTER_METHOD_MODIFIERS);
088: t.setToString("Within.method(" + modifier + ")");
089: return t;
090: }
091:
092: public static PointCutter userCode() {
093: PointCutter t = new NegatingPointCutter(
094: new ExecutionsInSystemClass());
095: t.setToString("Within.userCode()");
096: return t;
097: }
098:
099: public static PointCutter systemCode() {
100: PointCutter t = new ExecutionsInSystemClass();
101: t.setToString("Within.systemCode()");
102: return t;
103: }
104:
105: }
106:
107: //======================================================================
108: //
109: // $Log: Within.java,v $
110: // Revision 1.1.1.1 2003/07/02 15:30:52 apopovic
111: // Imported from ETH Zurich
112: //
113: // Revision 1.3 2003/05/25 11:46:50 popovici
114: // Improved 'toString' presentation of aspects
115: //
116: // Revision 1.2 2003/05/06 15:51:45 popovici
117: // Mozilla-ification
118: //
119: // Revision 1.1 2003/05/05 13:57:48 popovici
120: // renaming from runes to prose
121: //
122: // Revision 1.3 2003/04/27 13:08:50 popovici
123: // Specializers renamed to PointCutter
124: //
125: // Revision 1.2 2003/04/25 15:41:57 popovici
126: // Added the 'equalsTo' type filter in within
127: //
128: // Revision 1.1 2003/04/17 13:54:29 popovici
129: // Refactorization of 'ExecutionS' into 'Within' and 'Executions'.
130: // Method names refer now to 'types'
131: //
132: // Revision 1.2 2003/04/17 12:49:33 popovici
133: // Refactoring of the crosscut package
134: // ExceptionCut renamed to ThrowCut
135: // McutSignature is now SignaturePattern
136: //
137: // Revision 1.1 2003/04/17 08:47:40 popovici
138: // Important functionality additions
139: // - Cflow specializers
140: // - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
141: // - Transactional capabilities
142: // - Total refactoring of Specializer evaluation, which permits fine-grained distinction
143: // between static and dynamic specializers.
144: // - Functionality pulled up in abstract classes
145: // - Uniformization of advice methods patterns and names
146: //
|