Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java @ 1544:2b3d02626823
Opened Collection interface in preparation of Manual Points-Feature.
flys-client/trunk@3772 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 26 Jan 2012 13:24:17 +0000 |
parents | c899a7ffdc8f |
children | bb9ce9aece70 |
comparison
equal
deleted
inserted
replaced
1543:0b79630e3bcb | 1544:2b3d02626823 |
---|---|
102 this(uuid, ttl, name, recommendations); | 102 this(uuid, ttl, name, recommendations); |
103 this.themeLists = themeLists; | 103 this.themeLists = themeLists; |
104 this.settings = settings; | 104 this.settings = settings; |
105 } | 105 } |
106 | 106 |
107 | |
107 /** | 108 /** |
108 * Creates a new DefaultCollection with uuid and name. | 109 * Creates a new DefaultCollection with uuid and name. |
109 * | 110 * |
110 * @param uuid The identifier of this collection. | 111 * @param uuid The identifier of this collection. |
111 * @param name The name of this collection. | 112 * @param name The name of this collection. |
167 public int getItemLength() { | 168 public int getItemLength() { |
168 return items.size(); | 169 return items.size(); |
169 } | 170 } |
170 | 171 |
171 | 172 |
173 /** Returns item at index (0-based), or null if out of range. */ | |
172 public CollectionItem getItem(int idx) { | 174 public CollectionItem getItem(int idx) { |
173 if (idx >= getItemLength()) { | 175 if (idx >= getItemLength()) { |
174 return null; | 176 return null; |
175 } | 177 } |
176 | 178 |
177 return items.get(idx); | 179 return items.get(idx); |
180 } | |
181 | |
182 | |
183 /** | |
184 * Get item whose identifier is the given string. | |
185 * @param uuid identifier of collection item (artifacts uuid). | |
186 * @return CollectionItem whose identifier is given String, null if not found. | |
187 */ | |
188 public CollectionItem getItem(String uuid) { | |
189 int size = getItemLength(); | |
190 for (int i = 0; i < size; i++) { | |
191 CollectionItem item = getItem(i); | |
192 if (item.identifier().equals(uuid)) { | |
193 return item; | |
194 } | |
195 } | |
196 return null; | |
178 } | 197 } |
179 | 198 |
180 | 199 |
181 public Map<String, OutputMode> getOutputModes() { | 200 public Map<String, OutputMode> getOutputModes() { |
182 Map<String, OutputMode> modes = new HashMap<String, OutputMode>(); | 201 Map<String, OutputMode> modes = new HashMap<String, OutputMode>(); |