@Test public void getDepthTests() { Assert.assertEquals(0, new TachyonURI("/").getDepth()); Assert.assertEquals(1, new TachyonURI("/a").getDepth()); Assert.assertEquals(3, new TachyonURI("/a/b/c.txt").getDepth()); Assert.assertEquals(2, new TachyonURI("/a/b/").getDepth()); Assert.assertEquals(2, new TachyonURI("a\\b").getDepth()); Assert.assertEquals(1, new TachyonURI("C:\\\\a").getDepth()); Assert.assertEquals(0, new TachyonURI("C:\\\\").getDepth()); Assert.assertEquals(0, new TachyonURI("tachyon: Assert.assertEquals(1, new TachyonURI("tachyon: Assert.assertEquals(2, new TachyonURI("tachyon: }
public int getDepth() { String path = mUri.getPath(); int depth = 0; int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0; while (slash != -1) { depth ++; slash = path.indexOf(SEPARATOR, slash + 1); } return depth; }
TachyonURI implements Comparable<TachyonURI> { public int getDepth() { String path = mUri.getPath(); int depth = 0; int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0; while (slash != -1) { depth ++; slash = path.indexOf(SEPARATOR, slash + 1); } return depth; } }
TachyonURI implements Comparable<TachyonURI> { public int getDepth() { String path = mUri.getPath(); int depth = 0; int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0; while (slash != -1) { depth ++; slash = path.indexOf(SEPARATOR, slash + 1); } return depth; } TachyonURI(String pathStr);  TachyonURI(String scheme, String authority, String path);  TachyonURI(TachyonURI parent, TachyonURI child); }
TachyonURI implements Comparable<TachyonURI> { public int getDepth() { String path = mUri.getPath(); int depth = 0; int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0; while (slash != -1) { depth ++; slash = path.indexOf(SEPARATOR, slash + 1); } return depth; } TachyonURI(String pathStr);  TachyonURI(String scheme, String authority, String path);  TachyonURI(TachyonURI parent, TachyonURI child); @Override int compareTo(TachyonURI other); @Override boolean equals(Object o); String getAuthority(); int getDepth(); String getHost(); String getName(); TachyonURI getParent(); String getPath(); int getPort(); String getScheme(); boolean hasAuthority(); @Override int hashCode(); boolean hasScheme(); boolean isAbsolute(); boolean isPathAbsolute(); TachyonURI join(String suffix); TachyonURI join(TachyonURI suffix); @Override String toString(); }
TachyonURI implements Comparable<TachyonURI> { public int getDepth() { String path = mUri.getPath(); int depth = 0; int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0; while (slash != -1) { depth ++; slash = path.indexOf(SEPARATOR, slash + 1); } return depth; } TachyonURI(String pathStr);  TachyonURI(String scheme, String authority, String path);  TachyonURI(TachyonURI parent, TachyonURI child); @Override int compareTo(TachyonURI other); @Override boolean equals(Object o); String getAuthority(); int getDepth(); String getHost(); String getName(); TachyonURI getParent(); String getPath(); int getPort(); String getScheme(); boolean hasAuthority(); @Override int hashCode(); boolean hasScheme(); boolean isAbsolute(); boolean isPathAbsolute(); TachyonURI join(String suffix); TachyonURI join(TachyonURI suffix); @Override String toString(); static final String SEPARATOR; static final String CUR_DIR; }