aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/cgCache.java')
-rw-r--r--main/src/cgeo/geocaching/cgCache.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index b8590e5..cd4e15c 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -10,9 +10,11 @@ import cgeo.geocaching.connector.capability.ISearchByGeocode;
import cgeo.geocaching.connector.gc.GCConnector;
import cgeo.geocaching.connector.gc.GCConstants;
import cgeo.geocaching.connector.gc.Tile;
+import cgeo.geocaching.enumerations.CacheAttribute;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
+import cgeo.geocaching.enumerations.LoadFlags.LoadFlag;
import cgeo.geocaching.enumerations.LoadFlags.RemoveFlag;
import cgeo.geocaching.enumerations.LoadFlags.SaveFlag;
import cgeo.geocaching.enumerations.LogType;
@@ -1591,4 +1593,21 @@ public class cgCache implements ICache, IWaypoint {
}
return null;
}
+
+ /**
+ * check whether the cache has a given attribute
+ *
+ * @param attribute
+ * @param yes
+ * true if we are looking for the attribute_yes version, false for the attribute_no version
+ * @return
+ */
+ public boolean hasAttribute(CacheAttribute attribute, boolean yes) {
+ // lazy loading of attributes
+ cgCache fullCache = cgeoapplication.getInstance().loadCache(getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES));
+ if (fullCache == null) {
+ fullCache = this;
+ }
+ return fullCache.getAttributes().contains(attribute.getAttributeName(yes));
+ }
} \ No newline at end of file