@Test public void testIsChild() { Path p = new Path("/a/t", EnumSet.of(Path.Type.file)); assertTrue(p.isChild(new Path("/a", EnumSet.of(Path.Type.directory)))); assertTrue(p.isChild(new Path("/", EnumSet.of(Path.Type.directory)))); assertFalse(p.isChild(new Path("/a", EnumSet.of(Path.Type.file)))); final Path d = new Path("/a", EnumSet.of(Path.Type.directory)); d.attributes().setVersionId("1"); assertTrue(p.isChild(d)); }
public boolean isChild(final Path directory) { if(directory.isFile()) { return false; } if(this.isRoot()) { return false; } if(directory.isRoot()) { return true; } if(Objects.equals(this.getParent(), directory.getParent())) { return false; } for(Path parent = this.getParent(); !parent.isRoot(); parent = parent.getParent()) { if(new SimplePathPredicate(parent).test(directory)) { return true; } } return false; }
Path extends AbstractPath implements Referenceable, Serializable { public boolean isChild(final Path directory) { if(directory.isFile()) { return false; } if(this.isRoot()) { return false; } if(directory.isRoot()) { return true; } if(Objects.equals(this.getParent(), directory.getParent())) { return false; } for(Path parent = this.getParent(); !parent.isRoot(); parent = parent.getParent()) { if(new SimplePathPredicate(parent).test(directory)) { return true; } } return false; } }
Path extends AbstractPath implements Referenceable, Serializable { public boolean isChild(final Path directory) { if(directory.isFile()) { return false; } if(this.isRoot()) { return false; } if(directory.isRoot()) { return true; } if(Objects.equals(this.getParent(), directory.getParent())) { return false; } for(Path parent = this.getParent(); !parent.isRoot(); parent = parent.getParent()) { if(new SimplePathPredicate(parent).test(directory)) { return true; } } return false; } Path(final Path copy);  Path(final Path parent, final String name, final EnumSet<Type> type);  Path(final String absolute, final EnumSet<Type> type);  Path(final String absolute, final EnumSet<Type> type, final PathAttributes attributes);  Path(final Path parent, final String name, final EnumSet<Type> type, final PathAttributes attributes); }
Path extends AbstractPath implements Referenceable, Serializable { public boolean isChild(final Path directory) { if(directory.isFile()) { return false; } if(this.isRoot()) { return false; } if(directory.isRoot()) { return true; } if(Objects.equals(this.getParent(), directory.getParent())) { return false; } for(Path parent = this.getParent(); !parent.isRoot(); parent = parent.getParent()) { if(new SimplePathPredicate(parent).test(directory)) { return true; } } return false; } Path(final Path copy);  Path(final Path parent, final String name, final EnumSet<Type> type);  Path(final String absolute, final EnumSet<Type> type);  Path(final String absolute, final EnumSet<Type> type, final PathAttributes attributes);  Path(final Path parent, final String name, final EnumSet<Type> type, final PathAttributes attributes); @Override T serialize(final Serializer dict); @Override EnumSet<Type> getType(); void setType(final EnumSet<Type> type); boolean isVolume(); boolean isDirectory(); boolean isPlaceholder(); boolean isFile(); boolean isSymbolicLink(); @Override char getDelimiter(); Path getParent(); PathAttributes attributes(); void setAttributes(final PathAttributes attributes); Path withAttributes(final PathAttributes attributes); @Override String getName(); @Override String getAbsolute(); Path getSymlinkTarget(); void setSymlinkTarget(final Path target); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); boolean isChild(final Path directory); }
Path extends AbstractPath implements Referenceable, Serializable { public boolean isChild(final Path directory) { if(directory.isFile()) { return false; } if(this.isRoot()) { return false; } if(directory.isRoot()) { return true; } if(Objects.equals(this.getParent(), directory.getParent())) { return false; } for(Path parent = this.getParent(); !parent.isRoot(); parent = parent.getParent()) { if(new SimplePathPredicate(parent).test(directory)) { return true; } } return false; } Path(final Path copy);  Path(final Path parent, final String name, final EnumSet<Type> type);  Path(final String absolute, final EnumSet<Type> type);  Path(final String absolute, final EnumSet<Type> type, final PathAttributes attributes);  Path(final Path parent, final String name, final EnumSet<Type> type, final PathAttributes attributes); @Override T serialize(final Serializer dict); @Override EnumSet<Type> getType(); void setType(final EnumSet<Type> type); boolean isVolume(); boolean isDirectory(); boolean isPlaceholder(); boolean isFile(); boolean isSymbolicLink(); @Override char getDelimiter(); Path getParent(); PathAttributes attributes(); void setAttributes(final PathAttributes attributes); Path withAttributes(final PathAttributes attributes); @Override String getName(); @Override String getAbsolute(); Path getSymlinkTarget(); void setSymlinkTarget(final Path target); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); boolean isChild(final Path directory); static final char DELIMITER; }