diff --git a/pom.xml b/pom.xml
index 60d883d..50977a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,10 +4,10 @@
nz.ac.wgtn.yamf
yamf-parent
pom
- 1.0.6
+ 1.0.7
yamf-parent
- 1.0.6
+ 1.0.7
1.8
1.8
diff --git a/yamf-acceptancetests/pom.xml b/yamf-acceptancetests/pom.xml
index e4c75f1..e4da085 100644
--- a/yamf-acceptancetests/pom.xml
+++ b/yamf-acceptancetests/pom.xml
@@ -4,7 +4,7 @@
nz.ac.wgtn.yamf
yamf-parent
- 1.0.6
+ 1.0.7
nz.ac.wgtn.yamf
yamf-acceptancetests
diff --git a/yamf-bytecodechecks/pom.xml b/yamf-bytecodechecks/pom.xml
index 22f1d70..13e5504 100644
--- a/yamf-bytecodechecks/pom.xml
+++ b/yamf-bytecodechecks/pom.xml
@@ -4,7 +4,7 @@
nz.ac.wgtn.yamf
yamf-parent
- 1.0.6
+ 1.0.7
nz.ac.wgtn.yamf
yamf-bytecodechecks
diff --git a/yamf-core/pom.xml b/yamf-core/pom.xml
index 1ebf136..79240cf 100644
--- a/yamf-core/pom.xml
+++ b/yamf-core/pom.xml
@@ -4,7 +4,7 @@
nz.ac.wgtn.yamf
yamf-parent
- 1.0.6
+ 1.0.7
nz.ac.wgtn.yamf
yamf-core
diff --git a/yamf-core/src/main/java/nz/ac/wgtn/yamf/commons/Files.java b/yamf-core/src/main/java/nz/ac/wgtn/yamf/commons/Files.java
index 628a07f..08bd98c 100644
--- a/yamf-core/src/main/java/nz/ac/wgtn/yamf/commons/Files.java
+++ b/yamf-core/src/main/java/nz/ac/wgtn/yamf/commons/Files.java
@@ -19,6 +19,34 @@ public static String relativize(File file, File baseFolder) {
return pathBase.relativize(pathAbsolute).toString();
}
+ /**
+ * Find an ancestor satidfying a certain condition.
+ * @param file
+ * @param condition
+ * @param includeSelf -- whether file is also being considered
+ * @return
+ */
+ public static File findAncestorSuchThat(File file, Predicate condition, boolean includeSelf) {
+ Preconditions.checkNotNull(file);
+ Preconditions.checkArgument(file.exists());
+ if (includeSelf && condition.test(file)) {
+ return file;
+ }
+ return doFindAncestorSuchThat(file.getParentFile(),condition);
+ }
+
+ private static File doFindAncestorSuchThat(File file, Predicate condition) {
+ if (condition.test(file)) {
+ return file;
+ }
+ File parent = file.getParentFile();
+ if (parent==null) {
+ return null;
+ }
+ else {
+ return doFindAncestorSuchThat(parent,condition);
+ }
+ }
/**
* Breath-first traverse children to find a child file or folder satisfying a condition.
diff --git a/yamf-examples/pom.xml b/yamf-examples/pom.xml
index 58b5bd3..d167e1f 100644
--- a/yamf-examples/pom.xml
+++ b/yamf-examples/pom.xml
@@ -4,7 +4,7 @@
nz.ac.wgtn.yamf
yamf-parent
- 1.0.6
+ 1.0.7
nz.ac.wgtn.yamf
yamf-examples
diff --git a/yamf-msoffice-reporting/pom.xml b/yamf-msoffice-reporting/pom.xml
index 3d9576c..a8486df 100644
--- a/yamf-msoffice-reporting/pom.xml
+++ b/yamf-msoffice-reporting/pom.xml
@@ -4,7 +4,7 @@
nz.ac.wgtn.yamf
yamf-parent
- 1.0.6
+ 1.0.7
nz.ac.wgtn.yamf
yamf-msoffice-reporting
diff --git a/yamf-mvn/pom.xml b/yamf-mvn/pom.xml
index 37ea8d2..b20bf7d 100644
--- a/yamf-mvn/pom.xml
+++ b/yamf-mvn/pom.xml
@@ -4,7 +4,7 @@
nz.ac.wgtn.yamf
yamf-parent
- 1.0.6
+ 1.0.7
nz.ac.wgtn.yamf
yamf-mvn