KickJava   Java API By Example, From Geeks To Geeks.

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


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: ObjectInCollectionFilter.java,v 1.1 2003/07/17 11:14:17 apopovic Exp $
22
//=====================================================================
23
//
24
//(history at end)
25
//
26

27 package ch.ethz.prose.filter;
28 import java.util.Collection JavaDoc;
29
30   class ObjectInCollectionFilter extends ObjectFilter
31   {
32     Collection JavaDoc collection = null;
33     protected ObjectInCollectionFilter(int extrMethod, Collection JavaDoc col)
34       {
35     // use extractor to get the target/this object
36
super(extrMethod);
37
38     // precondition
39
if (collection == null)
40       throw new IllegalArgumentException JavaDoc("Target/This.inCollection(): null argument");
41
42     collection = col;
43
44       }
45
46     // the implementation of ObjectEquals
47
protected boolean doIsSpecialObject(Object JavaDoc target)
48       {
49     return collection.contains(target);
50       }
51   }
52
53
54 //====================================================================
55
//
56
//$Log: ObjectInCollectionFilter.java,v $
57
//Revision 1.1 2003/07/17 11:14:17 apopovic
58
//Added inCollection PointCutter. Improved Documentation
59
//
60
//
61
//
62
Popular Tags