KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > pobjects > collection > AllCollection


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.speedo.pobjects.collection;
19
20 import java.util.Collection JavaDoc;
21 import java.util.Set JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.HashSet JavaDoc;
24 import java.util.ArrayList JavaDoc;
25 import java.util.Vector JavaDoc;
26 import java.util.LinkedList JavaDoc;
27
28 /**
29  *
30  * @author S.Chassande-Barrioz
31  */

32 public class AllCollection {
33
34     private String JavaDoc id;
35
36     private Collection JavaDoc col_Long;
37     private Collection JavaDoc col_ref;
38
39     private Set JavaDoc set_Long;
40     private Set JavaDoc set_ref;
41     private HashSet JavaDoc hset_Long;
42     private HashSet JavaDoc hset_ref;
43
44     private List JavaDoc list_Long;
45     private List JavaDoc list_ref;
46     private ArrayList JavaDoc arraylist_Long;
47     private ArrayList JavaDoc arraylist_String;
48     private ArrayList JavaDoc arraylist_ref;
49     private Vector JavaDoc vector_Long;
50     private Vector JavaDoc vector_ref;
51     private LinkedList JavaDoc ll_Long;
52     private LinkedList JavaDoc ll_ref;
53
54     public AllCollection() {
55     }
56
57     public AllCollection(String JavaDoc id) {
58         this.id = id;
59     }
60
61     public String JavaDoc getId() {
62         return id;
63     }
64
65     public void setLongs(long[] ls) {
66         if (ls == null) {
67             col_Long = null;
68             set_Long = null;
69             list_Long = null;
70             hset_Long = null;
71             arraylist_Long = null;
72             vector_Long = null;
73             ll_Long = null;
74         } else {
75             col_Long = new ArrayList JavaDoc();
76             set_Long = new HashSet JavaDoc();
77             list_Long = new ArrayList JavaDoc();
78             hset_Long = new HashSet JavaDoc();
79             arraylist_Long = new ArrayList JavaDoc();
80             arraylist_String = new ArrayList JavaDoc();
81             vector_Long = new Vector JavaDoc();
82             ll_Long = new LinkedList JavaDoc();
83             addAll(ls);
84         }
85     }
86
87     public void addAll(long[] ls) {
88         for(int i=0; i<ls.length; i++) {
89             Long JavaDoc l = new Long JavaDoc(ls[i]);
90             if (col_Long != null) {
91                 col_Long.add(l);
92             }
93             if (set_Long != null) {
94                 set_Long.add(l);
95             }
96             if (list_Long != null) {
97                 list_Long.add(l);
98             }
99             if (hset_Long != null) {
100                 hset_Long.add(l);
101             }
102             if (arraylist_Long != null) {
103                 arraylist_Long.add(l);
104             }
105             if (arraylist_String != null) {
106                 arraylist_String.add(""+l);
107             }
108             if (vector_Long != null) {
109                 vector_Long.add(l);
110             }
111             if (ll_Long != null) {
112                 ll_Long.add(l);
113             }
114         }
115         
116     }
117     
118     public void setRefs(Object JavaDoc[] os) {
119         if (os == null) {
120             col_ref = null;
121             set_ref = null;
122             list_ref = null;
123             hset_ref = null;
124             arraylist_ref = null;
125             vector_ref = null;
126             ll_ref = null;
127         } else {
128             col_ref = new ArrayList JavaDoc();
129             set_ref = new HashSet JavaDoc();
130             list_ref = new ArrayList JavaDoc();
131             hset_ref = new HashSet JavaDoc();
132             arraylist_ref = new ArrayList JavaDoc();
133             vector_ref = new Vector JavaDoc();
134             ll_ref = new LinkedList JavaDoc();
135             for(int i=0; i<os.length; i++) {
136                 col_ref.add(os[i]);
137                 set_ref.add(os[i]);
138                 list_ref.add(os[i]);
139                 hset_ref.add(os[i]);
140                 arraylist_ref.add(os[i]);
141                 vector_ref.add(os[i]);
142                 ll_ref.add(os[i]);
143             }
144         }
145     }
146
147
148     public Collection JavaDoc getCol_Long() {
149         return col_Long;
150     }
151
152     public Collection JavaDoc getCol_ref() {
153         return col_ref;
154     }
155
156     public Set JavaDoc getSet_Long() {
157         return set_Long;
158     }
159
160     public Set JavaDoc getSet_ref() {
161         return set_ref;
162     }
163
164     public List JavaDoc getList_Long() {
165         return list_Long;
166     }
167
168     public List JavaDoc getList_ref() {
169         return list_ref;
170     }
171
172     public HashSet JavaDoc getHset_Long() {
173         return hset_Long;
174     }
175
176     public HashSet JavaDoc getHset_ref() {
177         return hset_ref;
178     }
179
180     public ArrayList JavaDoc getArraylist_Long() {
181         return arraylist_Long;
182     }
183     
184     public ArrayList JavaDoc getArraylist_String() {
185         return arraylist_String;
186     }
187
188     public ArrayList JavaDoc getArraylist_ref() {
189         return arraylist_ref;
190     }
191
192     public Vector JavaDoc getVector_Long() {
193         return vector_Long;
194     }
195
196     public Vector JavaDoc getVector_ref() {
197         return vector_ref;
198     }
199
200     public LinkedList JavaDoc getLl_Long() {
201         return ll_Long;
202     }
203
204     public LinkedList JavaDoc getLl_ref() {
205         return ll_ref;
206     }
207 }
208
Popular Tags