aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/list/AbstractList.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-09-14 14:21:22 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-09-14 14:21:34 +0200
commit947792ed914e4309ecb5159e9878ed15ea1125c9 (patch)
treec62689ef2b6ffa7bb1568e9525ed2760e45aec9a /main/src/cgeo/geocaching/list/AbstractList.java
parent3d5d4c46327244244003982f71aa627d1407d5c3 (diff)
downloadcgeo-947792ed914e4309ecb5159e9878ed15ea1125c9.zip
cgeo-947792ed914e4309ecb5159e9878ed15ea1125c9.tar.gz
cgeo-947792ed914e4309ecb5159e9878ed15ea1125c9.tar.bz2
refactoring: StoredList
* try more encapsulation instead of ID comparisons all time
Diffstat (limited to 'main/src/cgeo/geocaching/list/AbstractList.java')
-rw-r--r--main/src/cgeo/geocaching/list/AbstractList.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/list/AbstractList.java b/main/src/cgeo/geocaching/list/AbstractList.java
index c75c6a1..ec783eb 100644
--- a/main/src/cgeo/geocaching/list/AbstractList.java
+++ b/main/src/cgeo/geocaching/list/AbstractList.java
@@ -1,15 +1,28 @@
package cgeo.geocaching.list;
-abstract class AbstractList {
+import org.eclipse.jdt.annotation.Nullable;
+
+import android.util.SparseArray;
+
+public abstract class AbstractList {
public final int id;
public final String title;
+ private static SparseArray<AbstractList> LISTS = new SparseArray<AbstractList>();
public AbstractList(final int id, final String title) {
this.id = id;
this.title = title;
+ LISTS.put(id, this);
}
public abstract String getTitleAndCount();
+ public abstract boolean isConcrete();
+
+ @Nullable
+ public static AbstractList getListById(int listId) {
+ return LISTS.get(listId);
+ }
+
}