@Override public boolean equals(Object other) { if (!(other instanceof DirectoryDelegate)) { return false; } DirectoryDelegate dd = (DirectoryDelegate)other; if (this == dd) { return true; } // First, check names if (!Objects.equals(dir.getName(),dd.dir.getName())) { return false; } // Next up, check they have the same number of children if (dir.getEntryCount() != dd.dir.getEntryCount()) { return false; } return entries().equals(dd.entries()); } }
@Override public boolean equals(Object other) { if (!(other instanceof DirectoryDelegate)) { return false; } DirectoryDelegate dd = (DirectoryDelegate)other; if (this == dd) { return true; } // First, check names if (!Objects.equals(dir.getName(),dd.dir.getName())) { return false; } // Next up, check they have the same number of children if (dir.getEntryCount() != dd.dir.getEntryCount()) { return false; } return entries().equals(dd.entries()); } }
/** * Checks to see if the two Directories hold the same contents. * For this to be true, they must have entries with the same names, * no entries in one but not the other, and the size+contents * of each entry must match, and they must share names. * To exclude certain parts of the Directory from being checked, * use a {@link FilteringDirectoryNode} */ public static boolean areDirectoriesIdentical(DirectoryEntry dirA, DirectoryEntry dirB) { return new DirectoryDelegate(dirA).equals(new DirectoryDelegate(dirB)); }
private static POIDelegate toDelegate(Entry entry) { return (entry.isDirectoryEntry()) ? new DirectoryDelegate((DirectoryEntry)entry) : new DocumentDelegate((DocumentEntry)entry); }
private static POIDelegate toDelegate(Entry entry) { return (entry.isDirectoryEntry()) ? new DirectoryDelegate((DirectoryEntry)entry) : new DocumentDelegate((DocumentEntry)entry); }
/** * Checks to see if the two Directories hold the same contents. * For this to be true, they must have entries with the same names, * no entries in one but not the other, and the size+contents * of each entry must match, and they must share names. * To exclude certain parts of the Directory from being checked, * use a {@link FilteringDirectoryNode} */ public static boolean areDirectoriesIdentical(DirectoryEntry dirA, DirectoryEntry dirB) { return new DirectoryDelegate(dirA).equals(new DirectoryDelegate(dirB)); }