aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/cgCache.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2011-08-01 23:45:57 +0200
committerBananeweizen <bananeweizen@gmx.de>2011-08-01 23:45:57 +0200
commit53645ae292deb7f14ae3da2a19e2e9f11407746d (patch)
treef09ec31547516dd10fc1eb48fa9332efce0b40e6 /src/cgeo/geocaching/cgCache.java
parent27e6817f90ecbe8d67c1c36f14208d3578c64947 (diff)
downloadcgeo-53645ae292deb7f14ae3da2a19e2e9f11407746d.zip
cgeo-53645ae292deb7f14ae3da2a19e2e9f11407746d.tar.gz
cgeo-53645ae292deb7f14ae3da2a19e2e9f11407746d.tar.bz2
cleanup
* make potentially static methods static * remove unused constants * remove unused imports * move a cache related (otherwise static base) method to the cache class
Diffstat (limited to 'src/cgeo/geocaching/cgCache.java')
-rw-r--r--src/cgeo/geocaching/cgCache.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cgeo/geocaching/cgCache.java b/src/cgeo/geocaching/cgCache.java
index 8b2bb00..dae75e6 100644
--- a/src/cgeo/geocaching/cgCache.java
+++ b/src/cgeo/geocaching/cgCache.java
@@ -3,8 +3,11 @@ package cgeo.geocaching;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import android.text.Spannable;
+import android.util.Log;
public class cgCache {
@@ -233,4 +236,30 @@ public class cgCache {
}
return true;
}
+
+ /**
+ * checks if a page contains the guid of a cache
+ *
+ * @param cache the cache to look for
+ * @param page the page to search in
+ *
+ * @return true: page contains guid of cache, false: otherwise
+ */
+ boolean isGuidContainedInPage(final String page) {
+ // check if the guid of the cache is anywhere in the page
+ if (guid == null || guid.length() == 0) {
+ return false;
+ }
+ Pattern patternOk = Pattern.compile(guid, Pattern.CASE_INSENSITIVE);
+ Matcher matcherOk = patternOk.matcher(page);
+ if (matcherOk.find()) {
+ Log.i(cgSettings.tag, "cgCache.isGuidContainedInPage: guid '" + guid + "' found");
+ return true;
+ } else {
+ Log.i(cgSettings.tag, "cgCache.isGuidContainedInPage: guid '" + guid + "' not found");
+ return false;
+ }
+ }
+
+
}