m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/model
diff options
context:
space:
mode:
authorMartin <marcin.j.chrzanowski@gmail.com>2019-12-29 16:50:05 +0100
committerGitHub <noreply@github.com>2019-12-29 16:50:05 +0100
commit7f03e1ddbd73831499d63eee1075b0b1226fa173 (patch)
tree55bd25630a090c91e1a4362b68e32da22389dd1d /src/main/java/pl/edu/mimuw/cloudatlas/model
parent8b076ed54b692381a3c1410b704bdad33ad5ca0b (diff)
parentc3121bfa6c00682173a7f1fba9d4c524b8ef517e (diff)
Merge pull request #77 from m-chrzan/stanik
Stanik
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/model/ZMI.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ZMI.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ZMI.java
index 7f2f604..54fbf43 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ZMI.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ZMI.java
@@ -111,6 +111,23 @@ public class ZMI implements Cloneable, Serializable {
return descendant;
}
+ public boolean descendantExists(PathName path) {
+ try {
+ findDescendant(path);
+ return true;
+ } catch (NoSuchZoneException e) {
+ return false;
+ }
+ }
+
+ /*
+ * Convenient version of findDescendant that takes String representation of
+ * path.
+ */
+ public ZMI findDescendant(String pathString) throws NoSuchZoneException {
+ return findDescendant(new PathName(pathString));
+ }
+
/**
* Gets the list of sons of this ZMI. Modifying a value in the returned list will cause an exception.
*