aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/utils/UncertainProperty.java
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2013-08-14 08:34:38 -0700
committerBananeweizen <Bananeweizen@gmx.de>2013-08-14 08:34:38 -0700
commit33e84d8ac8619fdf174d0816e38bf25fdba9be91 (patch)
tree614d823f27103525d19cf585c84b102ab17e060d /main/src/cgeo/geocaching/utils/UncertainProperty.java
parent68c354d596249eff0d08b02483dfa3b94c0518fc (diff)
parent8617a044dd3d96f865b675dc50b95f72e6a749dd (diff)
downloadcgeo-33e84d8ac8619fdf174d0816e38bf25fdba9be91.zip
cgeo-33e84d8ac8619fdf174d0816e38bf25fdba9be91.tar.gz
cgeo-33e84d8ac8619fdf174d0816e38bf25fdba9be91.tar.bz2
Merge pull request #3128 from rsudev/issue3104
Fixes #3104, Wrong parsed cache type not corrected by nearby search and/...
Diffstat (limited to 'main/src/cgeo/geocaching/utils/UncertainProperty.java')
-rw-r--r--main/src/cgeo/geocaching/utils/UncertainProperty.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/utils/UncertainProperty.java b/main/src/cgeo/geocaching/utils/UncertainProperty.java
new file mode 100644
index 0000000..2187558
--- /dev/null
+++ b/main/src/cgeo/geocaching/utils/UncertainProperty.java
@@ -0,0 +1,39 @@
+package cgeo.geocaching.utils;
+
+import cgeo.geocaching.connector.gc.Tile;
+
+public class UncertainProperty<T> {
+
+ private final T value;
+ private final int certaintyLevel;
+
+ public UncertainProperty(T value) {
+ this.value = value;
+ this.certaintyLevel = Tile.ZOOMLEVEL_MAX + 1;
+ }
+
+ public UncertainProperty(T value, int certaintyLevel) {
+ this.value = value;
+ this.certaintyLevel = certaintyLevel;
+ }
+
+ public T getValue() {
+ return value;
+ }
+
+ public int getCertaintyLevel() {
+ return certaintyLevel;
+ }
+
+ public UncertainProperty<T> getMergedProperty(final UncertainProperty<T> other) {
+ if (other == null) {
+ return this;
+ }
+ if (other.certaintyLevel > certaintyLevel) {
+ return other;
+ }
+
+ return this;
+ }
+
+}