m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/model
diff options
context:
space:
mode:
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.
*