01: //
02: // This file is part of the prose package.
03: //
04: // The contents of this file are subject to the Mozilla Public License
05: // Version 1.1 (the "License"); you may not use this file except in
06: // compliance with the License. You may obtain a copy of the License at
07: // http://www.mozilla.org/MPL/
08: //
09: // 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: ObjectTypeFilter.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: /*---------------match name--------------------*/
30: class ObjectTypeFilter extends ObjectFilter {
31: private static final long serialVersionUID = 3256438118667073336L;
32: final static int SUBCLASS_INHERITANCE = 1;
33: final static int SUPERCLASS_INHERITANCE = 2;
34: final static int NO_INHERITANCE = 3;
35: private Class super Class;
36: private int inheritanceType;
37:
38: ObjectTypeFilter(int extractionMode, Class super Cls, int inhType) {
39: super (extractionMode);
40: this .super Class = super Cls;
41: this .inheritanceType = inhType;
42: }
43:
44: protected boolean doIsSpecialObject(Object target) {
45: if (target == null)
46: return false;
47: switch (inheritanceType) {
48: case SUBCLASS_INHERITANCE:
49: return super Class.isAssignableFrom(target.getClass());
50: case SUPERCLASS_INHERITANCE:
51: return target.getClass().isAssignableFrom(super Class);
52: case NO_INHERITANCE:
53: return super Class.equals(target);
54: default:
55: throw new Error("Illegal state: inheritanceType");
56: }
57: }
58: }
59:
60: //====================================================================
61: //
62: //$Log: ObjectTypeFilter.java,v $
63: //Revision 1.1.1.1 2003/07/02 15:30:52 apopovic
64: //Imported from ETH Zurich
65: //
66: //Revision 1.2 2003/05/06 15:51:43 popovici
67: //Mozilla-ification
68: //
69: //Revision 1.1 2003/05/05 13:57:57 popovici
70: //renaming from runes to prose
71: //
72: //Revision 1.1 2003/04/27 13:08:52 popovici
73: //Specializers renamed to PointCutter
74: //
75: //Revision 1.6 2003/04/26 14:33:49 popovici
76: //subtypeOf, supertypeOf specializers addde to this and target
77: //
78: //Revision 1.5 2003/04/17 12:49:34 popovici
79: //Refactoring of the crosscut package
80: // ExceptionCut renamed to ThrowCut
81: // McutSignature is now SignaturePattern
82: //
83: //Revision 1.4 2003/04/17 08:47:53 popovici
84: //Important functionality additions
85: // - Cflow specializers
86: // - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
87: // - Transactional capabilities
88: // - Total refactoring of Specializer evaluation, which permits fine-grained distinction
89: // between static and dynamic specializers.
90: // - Functionality pulled up in abstract classes
91: // - Uniformization of advice methods patterns and names
92: //
93: //Revision 1.3 2003/03/05 10:48:47 popovici
94: //Adapted tot the IKS template form
95: //
96: //
|