KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > idaremedia > antx > ExcludedFixture


1 /**
2  * $Id: ExcludedFixture.java 180 2007-03-15 12:56:38Z ssmc $
3  * Copyright 2004 iDare Media, Inc. All rights reserved.
4  *
5  * Originally written by iDare Media, Inc. for release into the public domain. This
6  * library, source form and binary form, is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License (LGPL) as published
8  * by the Free Software Foundation; either version 2.1 of the License, or (at your option)
9  * any later version.<p>
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU LGPL for more details.<p>
14  *
15  * You should have received a copy of the GNU Lesser General Public License along with this
16  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
17  * 330, Boston, MA 02111-1307 USA. The GNU LGPL can be found online at
18  * http://www.fsf.org/copyleft/lesser.html<p>
19  *
20  * This product has been influenced by several projects within the open-source community.
21  * The JWare developers wish to acknowledge the open-source community's support. For more
22  * information regarding the open-source products used within JWare, please visit the
23  * JWare website.
24  *----------------------------------------------------------------------------------------*
25  * WEBSITE- http://www.jware.info EMAIL- inquiries@jware.info
26  *----------------------------------------------------------------------------------------*
27  **/

28
29 package com.idaremedia.antx;
30
31 import java.util.Collection JavaDoc;
32 import java.util.List JavaDoc;
33
34 /**
35  * Default fixture exclusions for current application and/or iteration. A fixture
36  * exclusion can apply to certain AntX fixture components like overlays and bubbles.
37  * See each task's documentation for details on how/if if uses default fixture
38  * exclusions.
39  *
40  * @since JWare/AntX 0.5
41  * @author ssmc, &copy;2004 <a HREF="http://www.jware.info">iDare&nbsp;Media,&nbsp;Inc.</a>
42  * @version 0.5
43  * @.safety guarded
44  * @.group impl,helper
45  * @see Iteration#defaultFixtureExcludes
46  **/

47
48 public class ExcludedFixture
49 {
50     /**
51      * Initializes a new excluded fixture instance.
52      **/

53     public ExcludedFixture()
54     {
55     }
56
57
58     /**
59      * Adds a property's name to list of excluded fixture.
60      * @param property the name (non-null)
61      **/

62     public void addProperty(String JavaDoc property)
63     {
64         AntX.require_(property!=null,AntX.nopackage,"addProp- nonzro name");
65         m_xp.add(property);
66     }
67
68
69     /**
70      * Adds a set of property names en-masse to list of
71      * excluded fixture.
72      * @param properties the collection of properties (non-null)
73      **/

74     public void addProperties(Collection JavaDoc properties)
75     {
76         AntX.require_(properties!=null,AntX.nopackage,"addProps- nonzro lst");
77         m_xp.addAll(properties);
78     }
79
80
81     /**
82      * Adds a reference id to list of excluded fixture.
83      * @param refid the reference id (non-null)
84      **/

85     public void addReference(String JavaDoc refid)
86     {
87         AntX.require_(refid!=null,AntX.nopackage,"addRef- nonzro refid");
88         m_xr.add(refid);
89     }
90
91
92     /**
93      * Adds a set of reference identifiers en-masse to list
94      * of excluded fixture.
95      * @param refidset the collection of reference ids (non-null)
96      **/

97     public void addReferences(Collection JavaDoc refidset)
98     {
99         AntX.require_(refidset!=null,AntX.nopackage,"addRefs- nonzro lst");
100         m_xr.addAll(refidset);
101     }
102
103
104     /**
105      * Returns a <em>copy</em> of the current set of excluded
106      * properties. Returns a new list even if there are no
107      * excluded properties.
108      **/

109     public List JavaDoc copyOfProperties()
110     {
111         return AntXFixture.newListCopy(m_xp);
112     }
113
114
115
116     /**
117      * Returns a <em>copy</em> of the current set of excluded
118      * properties if there are any. Otherwise returns <i>null</i>.
119      **/

120     public List JavaDoc copyOfPropertiesIfAny()
121     {
122         synchronized(m_xp) {
123             if (m_xp.isEmpty()) {
124                 return null;
125             }
126             return AntXFixture.newListCopy(m_xp);
127         }
128     }
129
130
131
132     /**
133      * Copies the list of excluded properties directly into an
134      * existing collection of property names.
135      * @param properties collection of property names to update (non-null)
136      **/

137     public void addPropertiesTo(Collection JavaDoc properties)
138     {
139         AntX.require_(properties!=null,AntX.nopackage,"addPropsTo- nonzro lst");
140         synchronized(m_xp) {
141             if (!m_xp.isEmpty()) {
142                 properties.addAll(m_xp);
143             }
144         }
145     }
146
147
148     /**
149      * Returns a <em>copy</em> of the current set of excluded
150      * reference ids. Returns a new list even if there are no
151      * excluded references.
152      **/

153     public List JavaDoc copyOfReferences()
154     {
155         return AntXFixture.newListCopy(m_xr);
156     }
157
158
159
160     /**
161      * Returns a <em>copy</em> of the current set of excluded
162      * references if there are any. Otherwise returns <i>null</i>.
163      **/

164     public List JavaDoc copyOfReferencesIfAny()
165     {
166         synchronized(m_xr) {
167             if (m_xr.isEmpty()) {
168                 return null;
169             }
170             return AntXFixture.newListCopy(m_xr);
171         }
172     }
173
174
175
176     /**
177      * Copies the list of excluded reference ids directly into an
178      * existing collection of reference names.
179      * @param refidset the collection of reference ids to update (non-null)
180      **/

181     public void addReferencesTo(Collection JavaDoc refidset)
182     {
183         AntX.require_(refidset!=null,AntX.nopackage,"addRefsTo- nonzro lst");
184         synchronized(m_xr) {
185             if (!m_xr.isEmpty()) {
186                 refidset.addAll(m_xr);
187             }
188         }
189     }
190
191
192     /** Thread-safe list of excluded property names. **/
193     protected List JavaDoc m_xp= AntXFixture.newSynchronizedList();
194     
195     /** Thread-safe list of excluded reference names. **/
196     protected List JavaDoc m_xr= AntXFixture.newSynchronizedList();
197 }
198
199
200 /* end-of-ExcludedFixture.java */
Popular Tags