@Override public boolean startsWith(Path other) { JimfsPath otherPath = checkPath(other); return otherPath != null && getFileSystem().equals(otherPath.getFileSystem()) && Objects.equals(root, otherPath.root) && startsWith(names, otherPath.names); }
@Override public JimfsPath resolve(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { throw new ProviderMismatchException(other.toString()); } if (isEmptyPath() || otherPath.isAbsolute()) { return otherPath; } if (otherPath.isEmptyPath()) { return this; } return pathService.createPath( root, ImmutableList.<Name>builder() .addAll(names) .addAll(otherPath.names) .build()); }
@Override public JimfsPath relativize(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { throw new ProviderMismatchException(other.toString());
@Override public JimfsPath resolveSibling(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { throw new ProviderMismatchException(other.toString()); } if (otherPath.isAbsolute()) { return otherPath; } JimfsPath parent = getParent(); if (parent == null) { return otherPath; } return parent.resolve(other); }
@Override public boolean endsWith(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { return false; } if (otherPath.isAbsolute()) { return compareTo(otherPath) == 0; } return startsWith(names.reverse(), otherPath.names.reverse()); }
@Override public boolean startsWith(Path other) { JimfsPath otherPath = checkPath(other); return otherPath != null && getFileSystem().equals(otherPath.getFileSystem()) && Objects.equals(root, otherPath.root) && startsWith(names, otherPath.names); }
@Override public JimfsPath resolve(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { throw new ProviderMismatchException(other.toString()); } if (isEmptyPath() || otherPath.isAbsolute()) { return otherPath; } if (otherPath.isEmptyPath()) { return this; } return pathService.createPath( root, ImmutableList.<Name>builder() .addAll(names) .addAll(otherPath.names) .build()); }
@Override public JimfsPath relativize(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { throw new ProviderMismatchException(other.toString());
@Override public JimfsPath resolveSibling(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { throw new ProviderMismatchException(other.toString()); } if (otherPath.isAbsolute()) { return otherPath; } JimfsPath parent = getParent(); if (parent == null) { return otherPath; } return parent.resolve(other); }
@Override public boolean endsWith(Path other) { JimfsPath otherPath = checkPath(other); if (otherPath == null) { return false; } if (otherPath.isAbsolute()) { return compareTo(otherPath) == 0; } return startsWith(names.reverse(), otherPath.names.reverse()); }