@Test public void testCompareRootTo_VariousLengthPaths() { PropertyRegistration A = new PropertyRegistration("aaa.Root", "aaa"); PropertyRegistration B = new PropertyRegistration("Root", "bbb"); assertTrue(A.compareRootTo(B) > 0); A = new PropertyRegistration("Root", "aaa"); B = new PropertyRegistration("aaa.Root", "bbb"); assertTrue(A.compareRootTo(B) < 0); A = new PropertyRegistration("aaa.bbb.Root", "aaa"); B = new PropertyRegistration("zzz.Root", "bbb"); assertTrue(A.compareRootTo(B) < 0); A = new PropertyRegistration("zzz.Root", "aaa"); B = new PropertyRegistration("aaa.bbb.Root", "bbb"); assertTrue(A.compareRootTo(B) > 0); A = new PropertyRegistration("aaa.bbb.ccc.Root", "aaa"); B = new PropertyRegistration("aaa.zzz.Root", "bbb"); assertTrue(A.compareRootTo(B) < 0); A = new PropertyRegistration("aaa.zzz.Root", "aaa"); B = new PropertyRegistration("aaa.bbb.ccc.Root", "bbb"); assertTrue(A.compareRootTo(B) > 0); A = new PropertyRegistration("aaa.bbb.ccc.Root", "aaa"); B = new PropertyRegistration("aaa.bbb.Root", "bbb"); assertTrue(A.compareRootTo(B) > 0); A = new PropertyRegistration("aaa.bbb.Root", "aaa"); B = new PropertyRegistration("aaa.bbb.ccc.Root", "bbb"); assertTrue(A.compareRootTo(B) < 0); A = new PropertyRegistration("aaa.Root1", "aaa"); B = new PropertyRegistration("Root2", "aaa"); assertTrue(A.compareRootTo(B) > 0); A = new PropertyRegistration("aaa.bbb.Root1", "aaa"); B = new PropertyRegistration("aaa.Root2", "aaa"); assertTrue(A.compareRootTo(B) > 0); }
public int compareRootTo(PropertyRegistration o) { if (classCanonName.equals(o.classCanonName)) { return 0; } else { String[] thisPath = classCanonName.split("\\."); String[] thatPath = o.classCanonName.split("\\."); int minLen = Math.min(thisPath.length, thatPath.length); for (int i = 0; i < minLen; i++) { if (i == (minLen - 1)) { if (thisPath.length < thatPath.length) { return -1; } else if (thisPath.length > thatPath.length) { return 1; } else { return thisPath[i].compareTo(thatPath[i]); } } else { int comp = thisPath[i].compareTo(thatPath[i]); if (comp != 0) { return comp; } } } return 0; } }
PropertyRegistration implements Comparable<PropertyRegistration> { public int compareRootTo(PropertyRegistration o) { if (classCanonName.equals(o.classCanonName)) { return 0; } else { String[] thisPath = classCanonName.split("\\."); String[] thatPath = o.classCanonName.split("\\."); int minLen = Math.min(thisPath.length, thatPath.length); for (int i = 0; i < minLen; i++) { if (i == (minLen - 1)) { if (thisPath.length < thatPath.length) { return -1; } else if (thisPath.length > thatPath.length) { return 1; } else { return thisPath[i].compareTo(thatPath[i]); } } else { int comp = thisPath[i].compareTo(thatPath[i]); if (comp != 0) { return comp; } } } return 0; } } }
PropertyRegistration implements Comparable<PropertyRegistration> { public int compareRootTo(PropertyRegistration o) { if (classCanonName.equals(o.classCanonName)) { return 0; } else { String[] thisPath = classCanonName.split("\\."); String[] thatPath = o.classCanonName.split("\\."); int minLen = Math.min(thisPath.length, thatPath.length); for (int i = 0; i < minLen; i++) { if (i == (minLen - 1)) { if (thisPath.length < thatPath.length) { return -1; } else if (thisPath.length > thatPath.length) { return 1; } else { return thisPath[i].compareTo(thatPath[i]); } } else { int comp = thisPath[i].compareTo(thatPath[i]); if (comp != 0) { return comp; } } } return 0; } } PropertyRegistration(String classCanonName, String propName);   PropertyRegistration(String classCanonName, String propName, String... innerPathNesting); }
PropertyRegistration implements Comparable<PropertyRegistration> { public int compareRootTo(PropertyRegistration o) { if (classCanonName.equals(o.classCanonName)) { return 0; } else { String[] thisPath = classCanonName.split("\\."); String[] thatPath = o.classCanonName.split("\\."); int minLen = Math.min(thisPath.length, thatPath.length); for (int i = 0; i < minLen; i++) { if (i == (minLen - 1)) { if (thisPath.length < thatPath.length) { return -1; } else if (thisPath.length > thatPath.length) { return 1; } else { return thisPath[i].compareTo(thatPath[i]); } } else { int comp = thisPath[i].compareTo(thatPath[i]); if (comp != 0) { return comp; } } } return 0; } } PropertyRegistration(String classCanonName, String propName);   PropertyRegistration(String classCanonName, String propName, String... innerPathNesting); String getCanonicalRootName(); String getPropertyName(); String[] getInnerPath(); int getInnerPathLength(); String getCanonicalPropertyName(); String getJavaCanonicalParentName(); String getCanonicalParentName(); int compareRootTo(PropertyRegistration o); int compareInnerPathTo(PropertyRegistration o); @Override int compareTo(PropertyRegistration o); }
PropertyRegistration implements Comparable<PropertyRegistration> { public int compareRootTo(PropertyRegistration o) { if (classCanonName.equals(o.classCanonName)) { return 0; } else { String[] thisPath = classCanonName.split("\\."); String[] thatPath = o.classCanonName.split("\\."); int minLen = Math.min(thisPath.length, thatPath.length); for (int i = 0; i < minLen; i++) { if (i == (minLen - 1)) { if (thisPath.length < thatPath.length) { return -1; } else if (thisPath.length > thatPath.length) { return 1; } else { return thisPath[i].compareTo(thatPath[i]); } } else { int comp = thisPath[i].compareTo(thatPath[i]); if (comp != 0) { return comp; } } } return 0; } } PropertyRegistration(String classCanonName, String propName);   PropertyRegistration(String classCanonName, String propName, String... innerPathNesting); String getCanonicalRootName(); String getPropertyName(); String[] getInnerPath(); int getInnerPathLength(); String getCanonicalPropertyName(); String getJavaCanonicalParentName(); String getCanonicalParentName(); int compareRootTo(PropertyRegistration o); int compareInnerPathTo(PropertyRegistration o); @Override int compareTo(PropertyRegistration o);  }