@Test public void testCompareTo() { SymbolPath symbolPath1 = new SymbolPath("aaa::bbb::bob"); SymbolPath symbolPath2 = new SymbolPath("aaa"); SymbolPath symbolPath3 = new SymbolPath("zzz"); SymbolPath symbolPath4 = new SymbolPath("aaa::bbb::joe"); SymbolPath symbolPath5 = new SymbolPath("aaa::ccc::joe"); assertTrue(symbolPath1.compareTo(symbolPath2) > 0); assertTrue(symbolPath2.compareTo(symbolPath1) < 0); assertTrue(symbolPath1.compareTo(symbolPath1) == 0); assertTrue(symbolPath3.compareTo(symbolPath2) > 0); assertTrue(symbolPath2.compareTo(symbolPath3) < 0); assertTrue(symbolPath4.compareTo(symbolPath1) > 0); assertTrue(symbolPath1.compareTo(symbolPath4) < 0); assertTrue(symbolPath5.compareTo(symbolPath4) > 0); assertTrue(symbolPath4.compareTo(symbolPath5) < 0); }
@Override public int compareTo(SymbolPath o) { SymbolPath otherParentPath = o.getParent(); int result = 0; if (parentPath == null) { if (otherParentPath != null) { return -1; } } else if (otherParentPath == null) { return 1; } else { result = parentPath.compareTo(otherParentPath); } if (result == 0) { result = symbolName.compareTo(o.getName()); } return result; }
SymbolPath implements Comparable<SymbolPath> { @Override public int compareTo(SymbolPath o) { SymbolPath otherParentPath = o.getParent(); int result = 0; if (parentPath == null) { if (otherParentPath != null) { return -1; } } else if (otherParentPath == null) { return 1; } else { result = parentPath.compareTo(otherParentPath); } if (result == 0) { result = symbolName.compareTo(o.getName()); } return result; } }
SymbolPath implements Comparable<SymbolPath> { @Override public int compareTo(SymbolPath o) { SymbolPath otherParentPath = o.getParent(); int result = 0; if (parentPath == null) { if (otherParentPath != null) { return -1; } } else if (otherParentPath == null) { return 1; } else { result = parentPath.compareTo(otherParentPath); } if (result == 0) { result = symbolName.compareTo(o.getName()); } return result; } SymbolPath(String symbolPathString);  SymbolPath(String[] symbolPath);  SymbolPath(List<String> symbolList);  SymbolPath(Symbol symbol);  SymbolPath(Symbol symbol, boolean excludeLibrary);  SymbolPath(SymbolPath parent, String name); }
SymbolPath implements Comparable<SymbolPath> { @Override public int compareTo(SymbolPath o) { SymbolPath otherParentPath = o.getParent(); int result = 0; if (parentPath == null) { if (otherParentPath != null) { return -1; } } else if (otherParentPath == null) { return 1; } else { result = parentPath.compareTo(otherParentPath); } if (result == 0) { result = symbolName.compareTo(o.getName()); } return result; } SymbolPath(String symbolPathString);  SymbolPath(String[] symbolPath);  SymbolPath(List<String> symbolList);  SymbolPath(Symbol symbol);  SymbolPath(Symbol symbol, boolean excludeLibrary);  SymbolPath(SymbolPath parent, String name); SymbolPath replaceInvalidChars(); String getName(); SymbolPath getParent(); String getParentPath(); String getPath(); SymbolPath append(SymbolPath path); @Override int hashCode(); @Override boolean equals(Object obj); List<String> asList(); String[] asArray(); @Override String toString(); @Override int compareTo(SymbolPath o); }
SymbolPath implements Comparable<SymbolPath> { @Override public int compareTo(SymbolPath o) { SymbolPath otherParentPath = o.getParent(); int result = 0; if (parentPath == null) { if (otherParentPath != null) { return -1; } } else if (otherParentPath == null) { return 1; } else { result = parentPath.compareTo(otherParentPath); } if (result == 0) { result = symbolName.compareTo(o.getName()); } return result; } SymbolPath(String symbolPathString);  SymbolPath(String[] symbolPath);  SymbolPath(List<String> symbolList);  SymbolPath(Symbol symbol);  SymbolPath(Symbol symbol, boolean excludeLibrary);  SymbolPath(SymbolPath parent, String name); SymbolPath replaceInvalidChars(); String getName(); SymbolPath getParent(); String getParentPath(); String getPath(); SymbolPath append(SymbolPath path); @Override int hashCode(); @Override boolean equals(Object obj); List<String> asList(); String[] asArray(); @Override String toString(); @Override int compareTo(SymbolPath o);  }