001: /**
002: * Copyright (C) 2001-2004 France Telecom R&D
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */package org.objectweb.speedo.pobjects.collection;
018:
019: import java.util.Collection;
020: import java.util.Set;
021: import java.util.List;
022: import java.util.HashSet;
023: import java.util.ArrayList;
024: import java.util.Vector;
025: import java.util.LinkedList;
026:
027: /**
028: *
029: * @author S.Chassande-Barrioz
030: */
031: public class AllCollection {
032:
033: private String id;
034:
035: private Collection col_Long;
036: private Collection col_ref;
037:
038: private Set set_Long;
039: private Set set_ref;
040: private HashSet hset_Long;
041: private HashSet hset_ref;
042:
043: private List list_Long;
044: private List list_ref;
045: private ArrayList arraylist_Long;
046: private ArrayList arraylist_String;
047: private ArrayList arraylist_ref;
048: private Vector vector_Long;
049: private Vector vector_ref;
050: private LinkedList ll_Long;
051: private LinkedList ll_ref;
052:
053: public AllCollection() {
054: }
055:
056: public AllCollection(String id) {
057: this .id = id;
058: }
059:
060: public String getId() {
061: return id;
062: }
063:
064: public void setLongs(long[] ls) {
065: if (ls == null) {
066: col_Long = null;
067: set_Long = null;
068: list_Long = null;
069: hset_Long = null;
070: arraylist_Long = null;
071: vector_Long = null;
072: ll_Long = null;
073: } else {
074: col_Long = new ArrayList();
075: set_Long = new HashSet();
076: list_Long = new ArrayList();
077: hset_Long = new HashSet();
078: arraylist_Long = new ArrayList();
079: arraylist_String = new ArrayList();
080: vector_Long = new Vector();
081: ll_Long = new LinkedList();
082: addAll(ls);
083: }
084: }
085:
086: public void addAll(long[] ls) {
087: for (int i = 0; i < ls.length; i++) {
088: Long l = new Long(ls[i]);
089: if (col_Long != null) {
090: col_Long.add(l);
091: }
092: if (set_Long != null) {
093: set_Long.add(l);
094: }
095: if (list_Long != null) {
096: list_Long.add(l);
097: }
098: if (hset_Long != null) {
099: hset_Long.add(l);
100: }
101: if (arraylist_Long != null) {
102: arraylist_Long.add(l);
103: }
104: if (arraylist_String != null) {
105: arraylist_String.add("" + l);
106: }
107: if (vector_Long != null) {
108: vector_Long.add(l);
109: }
110: if (ll_Long != null) {
111: ll_Long.add(l);
112: }
113: }
114:
115: }
116:
117: public void setRefs(Object[] os) {
118: if (os == null) {
119: col_ref = null;
120: set_ref = null;
121: list_ref = null;
122: hset_ref = null;
123: arraylist_ref = null;
124: vector_ref = null;
125: ll_ref = null;
126: } else {
127: col_ref = new ArrayList();
128: set_ref = new HashSet();
129: list_ref = new ArrayList();
130: hset_ref = new HashSet();
131: arraylist_ref = new ArrayList();
132: vector_ref = new Vector();
133: ll_ref = new LinkedList();
134: for (int i = 0; i < os.length; i++) {
135: col_ref.add(os[i]);
136: set_ref.add(os[i]);
137: list_ref.add(os[i]);
138: hset_ref.add(os[i]);
139: arraylist_ref.add(os[i]);
140: vector_ref.add(os[i]);
141: ll_ref.add(os[i]);
142: }
143: }
144: }
145:
146: public Collection getCol_Long() {
147: return col_Long;
148: }
149:
150: public Collection getCol_ref() {
151: return col_ref;
152: }
153:
154: public Set getSet_Long() {
155: return set_Long;
156: }
157:
158: public Set getSet_ref() {
159: return set_ref;
160: }
161:
162: public List getList_Long() {
163: return list_Long;
164: }
165:
166: public List getList_ref() {
167: return list_ref;
168: }
169:
170: public HashSet getHset_Long() {
171: return hset_Long;
172: }
173:
174: public HashSet getHset_ref() {
175: return hset_ref;
176: }
177:
178: public ArrayList getArraylist_Long() {
179: return arraylist_Long;
180: }
181:
182: public ArrayList getArraylist_String() {
183: return arraylist_String;
184: }
185:
186: public ArrayList getArraylist_ref() {
187: return arraylist_ref;
188: }
189:
190: public Vector getVector_Long() {
191: return vector_Long;
192: }
193:
194: public Vector getVector_ref() {
195: return vector_ref;
196: }
197:
198: public LinkedList getLl_Long() {
199: return ll_Long;
200: }
201:
202: public LinkedList getLl_ref() {
203: return ll_ref;
204: }
205: }
|