@Override public boolean equals(Object obj) { if (obj instanceof IResource) { return _path.equals(((IResource) obj).getPath()); } else { return false; } }
public boolean isDescendant(ResourcePath path) { ResourcePath pathToTest = path; while (pathToTest != null) { if (pathToTest.equals(this)) { return true; } pathToTest = pathToTest.getParent(); } return false; }
@Override public boolean equals(Object obj) { if (obj instanceof IResource) { return _path.equals(((IResource) obj).getPath()); } else { return false; } }
public boolean isDescendant(ResourcePath path) { ResourcePath pathToTest = path; while (pathToTest != null) { if (pathToTest.equals(this)) { return true; } pathToTest = pathToTest.getParent(); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof JarFileDirectoryImpl) { return getPath().equals(((JarFileDirectoryImpl) obj).getPath()); } else { return false; } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof JarEntryResourceImpl) { return getPath().equals(((JarEntryResourceImpl) obj).getPath()); } else { return false; } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof JarEntryResourceImpl) { return getPath().equals(((JarEntryResourceImpl) obj).getPath()); } else { return false; } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof JarFileDirectoryImpl) { return getPath().equals(((JarFileDirectoryImpl) obj).getPath()); } else { return false; } }
public String relativePath(ResourcePath other, String separator) { List<String> pathComponents = new ArrayList<String>(); ResourcePath pathToTest = other; boolean success = false; while (pathToTest != null) { if (pathToTest.equals(this)) { success = true; break; } pathComponents.add(0, pathToTest.getName()); pathToTest = pathToTest.getParent(); } if (!success || pathComponents.isEmpty()) { return null; } else { return GosuStringUtil.join(pathComponents, separator); } }
public String relativePath(ResourcePath other, String separator) { List<String> pathComponents = new ArrayList<String>(); ResourcePath pathToTest = other; boolean success = false; while (pathToTest != null) { if (pathToTest.equals(this)) { success = true; break; } pathComponents.add(0, pathToTest.getName()); pathToTest = pathToTest.getParent(); } if (!success || pathComponents.isEmpty()) { return null; } else { return GosuStringUtil.join(pathComponents, separator); } }