diff --git a/dbptk-model/pom.xml b/dbptk-model/pom.xml
index a81e63ef..7a8e4d05 100644
--- a/dbptk-model/pom.xml
+++ b/dbptk-model/pom.xml
@@ -76,6 +76,12 @@
jaxb-impl
2.3.7
+
+ com.google.guava
+ guava
+ 33.0.0-jre
+ compile
+
diff --git a/dbptk-model/src/main/java/com/databasepreservation/model/data/ArrayCell.java b/dbptk-model/src/main/java/com/databasepreservation/model/data/ArrayCell.java
index a009dd41..b0c4763c 100644
--- a/dbptk-model/src/main/java/com/databasepreservation/model/data/ArrayCell.java
+++ b/dbptk-model/src/main/java/com/databasepreservation/model/data/ArrayCell.java
@@ -38,6 +38,14 @@ public ArrayCell(String id) {
super(id);
}
+ private static void toArraySetValue(Object array, T value, Integer... indexes) {
+ if (indexes.length == 1) {
+ ((T[]) array)[indexes[0] - 1] = value;
+ } else {
+ toArraySetValue(Array.get(array, indexes[0] - 1), value, Arrays.copyOfRange(indexes, 1, indexes.length));
+ }
+ }
+
public void put(Cell value, Collection position) {
// ensure all arraylists are similar so they can be compared
ComparableIntegerList standardPosition = new ComparableIntegerList();
@@ -59,7 +67,7 @@ public void put(Cell value, Integer... position) {
*
* Example: for [[A][B,C]] this iterator would return: (1,1:A), then (2,1:B) and
* finally (2,2:C).
- *
+ *
* @return ordered list of cells in a n-dimensional array, paired with their
* position in the array.
*/
@@ -74,34 +82,6 @@ public Pair, Cell> apply(Map.Entry in
});
}
- private static class ComparableIntegerList extends ArrayList implements Comparable {
- public ComparableIntegerList() {
- super();
- }
-
- /**
- * The first different number between the lists (checked in order) defines the
- * result of the comparison (null is considered less than any number). In a
- * draw, the smaller list is "less than" the other.
- */
- @Override
- public int compareTo(ComparableIntegerList other) {
- int minSize = this.size() < other.size() ? this.size() : other.size();
- for (int i = 0; i < minSize; i++) {
- if (this.get(i) != other.get(i)) {
- if (this.get(i) == null) {
- return -1;
- }
- if (other.get(i) == null) {
- return 1;
- }
- return this.get(i).compareTo(other.get(i));
- }
- }
- return Integer.compare(this.size(), other.size());
- }
- }
-
public boolean isEmpty() {
return arrayData.isEmpty();
}
@@ -140,14 +120,6 @@ public int calculateDimensions() {
}
}
- private static void toArraySetValue(Object array, T value, Integer... indexes) {
- if (indexes.length == 1) {
- ((T[]) array)[indexes[0] - 1] = value;
- } else {
- toArraySetValue(Array.get(array, indexes[0] - 1), value, Arrays.copyOfRange(indexes, 1, indexes.length));
- }
- }
-
public Object[] toArray(Function cellToObject, Class objectClass) throws InvalidDataException {
if (arrayData.isEmpty()) {
return new Object[] {};
@@ -184,4 +156,32 @@ public Object[] toArray(Function cellToObject, Class objectClass
return (Object[]) multidimensionalArray;
}
+
+ private static class ComparableIntegerList extends ArrayList implements Comparable {
+ public ComparableIntegerList() {
+ super();
+ }
+
+ /**
+ * The first different number between the lists (checked in order) defines the
+ * result of the comparison (null is considered less than any number). In a
+ * draw, the smaller list is "less than" the other.
+ */
+ @Override
+ public int compareTo(ComparableIntegerList other) {
+ int minSize = this.size() < other.size() ? this.size() : other.size();
+ for (int i = 0; i < minSize; i++) {
+ if (this.get(i) != other.get(i)) {
+ if (this.get(i) == null) {
+ return -1;
+ }
+ if (other.get(i) == null) {
+ return 1;
+ }
+ return this.get(i).compareTo(other.get(i));
+ }
+ }
+ return Integer.compare(this.size(), other.size());
+ }
+ }
}
diff --git a/pom.xml b/pom.xml
index 5887101d..a6a605ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -313,7 +313,7 @@
org.reflections
reflections
- 0.9.11
+ 0.10.2
| |