@Test public void testIsSameOrHasParent() throws Exception { assertTrue(new ExtraFile("file: assertTrue(new ExtraFile("file: assertTrue(new ExtraFile("file: assertTrue(new ExtraFile("file: assertFalse(new ExtraFile("file: assertFalse(new ExtraFile("file: assertFalse(new ExtraFile("file: assertFalse(new ExtraFile("file: assertFalse(new ExtraFile("file: assertFalse(new ExtraFile("file: final File base = new File("/some/base"); assertTrue(new ExtraFile(MMapURI.makeFromFilePath(base, "chunga/changa.txt", null)).isSameOrHasParent(base, new MMapURI(base,new File("chunga/changa.txt"),null))); assertFalse(new ExtraFile(MMapURI.makeFromFilePath(base, "chunga/changa.txt", null)).isSameOrHasParent(base, new MMapURI(base,new File("chunga/changa.tx"),null))); assertFalse(new ExtraFile(MMapURI.makeFromFilePath(base, "chunga/changa.tx", null)).isSameOrHasParent(base, new MMapURI(base,new File("chunga/changa.txt"),null))); assertTrue(new ExtraFile(MMapURI.makeFromFilePath(base, "chunga/changa.txt", null)).isSameOrHasParent(base, new MMapURI("file: }
public boolean isSameOrHasParent(@Nullable final File baseFolder, @Nonnull final MMapURI file) { final File theFile = this.fileUri.asFile(baseFolder); final File thatFile = file.asFile(baseFolder); final String theFilePath = FilenameUtils.normalize(theFile.getAbsolutePath()); final String thatFilePath = FilenameUtils.normalize(thatFile.getAbsolutePath()); if (theFilePath.startsWith(thatFilePath)) { final String diff = theFilePath.substring(thatFilePath.length()); return diff.isEmpty() || diff.startsWith("\\") || diff.startsWith("/") || thatFilePath.endsWith("/") || thatFilePath.endsWith("\\"); } else { return false; } }
ExtraFile extends Extra<MMapURI> implements ExtraLinkable { public boolean isSameOrHasParent(@Nullable final File baseFolder, @Nonnull final MMapURI file) { final File theFile = this.fileUri.asFile(baseFolder); final File thatFile = file.asFile(baseFolder); final String theFilePath = FilenameUtils.normalize(theFile.getAbsolutePath()); final String thatFilePath = FilenameUtils.normalize(thatFile.getAbsolutePath()); if (theFilePath.startsWith(thatFilePath)) { final String diff = theFilePath.substring(thatFilePath.length()); return diff.isEmpty() || diff.startsWith("\\") || diff.startsWith("/") || thatFilePath.endsWith("/") || thatFilePath.endsWith("\\"); } else { return false; } } }
ExtraFile extends Extra<MMapURI> implements ExtraLinkable { public boolean isSameOrHasParent(@Nullable final File baseFolder, @Nonnull final MMapURI file) { final File theFile = this.fileUri.asFile(baseFolder); final File thatFile = file.asFile(baseFolder); final String theFilePath = FilenameUtils.normalize(theFile.getAbsolutePath()); final String thatFilePath = FilenameUtils.normalize(thatFile.getAbsolutePath()); if (theFilePath.startsWith(thatFilePath)) { final String diff = theFilePath.substring(thatFilePath.length()); return diff.isEmpty() || diff.startsWith("\\") || diff.startsWith("/") || thatFilePath.endsWith("/") || thatFilePath.endsWith("\\"); } else { return false; } } ExtraFile(@Nonnull final MMapURI file);  ExtraFile(@Nonnull final String text); }
ExtraFile extends Extra<MMapURI> implements ExtraLinkable { public boolean isSameOrHasParent(@Nullable final File baseFolder, @Nonnull final MMapURI file) { final File theFile = this.fileUri.asFile(baseFolder); final File thatFile = file.asFile(baseFolder); final String theFilePath = FilenameUtils.normalize(theFile.getAbsolutePath()); final String thatFilePath = FilenameUtils.normalize(thatFile.getAbsolutePath()); if (theFilePath.startsWith(thatFilePath)) { final String diff = theFilePath.substring(thatFilePath.length()); return diff.isEmpty() || diff.startsWith("\\") || diff.startsWith("/") || thatFilePath.endsWith("/") || thatFilePath.endsWith("\\"); } else { return false; } } ExtraFile(@Nonnull final MMapURI file);  ExtraFile(@Nonnull final String text); @Override boolean containsPattern(@Nullable final File baseFolder, @Nonnull final Pattern pattern); @Override int hashCode(); @Override boolean equals(@Nullable final Object that); boolean isMMDFile(); @Nonnull String getLCFileExtension(); @Override @Nonnull MMapURI getValue(); @Override @Nonnull ExtraType getType(); @Override @Nonnull String getAsString(); @Override @Nonnull String provideAsStringForSave(); @Override @Nonnull MMapURI getAsURI(); boolean isAbsolute(); @Nullable ExtraFile replaceParentPath(@Nullable final File baseFolder, @Nonnull final MMapURI oldFolder, @Nonnull final MMapURI newFolder); boolean hasParent(@Nullable final File baseFolder, @Nonnull final MMapURI folder); boolean isSameOrHasParent(@Nullable final File baseFolder, @Nonnull final MMapURI file); boolean isSame(@Nullable final File baseFolder, @Nonnull final MMapURI file); }
ExtraFile extends Extra<MMapURI> implements ExtraLinkable { public boolean isSameOrHasParent(@Nullable final File baseFolder, @Nonnull final MMapURI file) { final File theFile = this.fileUri.asFile(baseFolder); final File thatFile = file.asFile(baseFolder); final String theFilePath = FilenameUtils.normalize(theFile.getAbsolutePath()); final String thatFilePath = FilenameUtils.normalize(thatFile.getAbsolutePath()); if (theFilePath.startsWith(thatFilePath)) { final String diff = theFilePath.substring(thatFilePath.length()); return diff.isEmpty() || diff.startsWith("\\") || diff.startsWith("/") || thatFilePath.endsWith("/") || thatFilePath.endsWith("\\"); } else { return false; } } ExtraFile(@Nonnull final MMapURI file);  ExtraFile(@Nonnull final String text); @Override boolean containsPattern(@Nullable final File baseFolder, @Nonnull final Pattern pattern); @Override int hashCode(); @Override boolean equals(@Nullable final Object that); boolean isMMDFile(); @Nonnull String getLCFileExtension(); @Override @Nonnull MMapURI getValue(); @Override @Nonnull ExtraType getType(); @Override @Nonnull String getAsString(); @Override @Nonnull String provideAsStringForSave(); @Override @Nonnull MMapURI getAsURI(); boolean isAbsolute(); @Nullable ExtraFile replaceParentPath(@Nullable final File baseFolder, @Nonnull final MMapURI oldFolder, @Nonnull final MMapURI newFolder); boolean hasParent(@Nullable final File baseFolder, @Nonnull final MMapURI folder); boolean isSameOrHasParent(@Nullable final File baseFolder, @Nonnull final MMapURI file); boolean isSame(@Nullable final File baseFolder, @Nonnull final MMapURI file);  }