@Test public void testCommonCase() { FileFolder root = new FileFolder(new Path("../../Root"), null); FileFolder f1 = new FileFolder(root, "Folder1", null); FileFolder f2 = new FileFolder(root, "Folder2", null); FileFolder sf = new FileFolder(f1, "SubFolder", null); root.setChecked(true); f1.setChecked(false); f2.setChecked(true); sf.setChecked(false); TreeCheckState checkState = root.getTreeCheckState(); List<FileFolder> folders = Arrays.asList(root, f1, f2, sf); for (FileFolder f : folders) { boolean actualOutput = checkState.isChecked(f.getPath()); assertEquals(f.isChecked(), actualOutput); } }
public boolean isChecked(@NotNull Path path) { Util.checkNotNull(path); if (checkedSet.isEmpty()) return false; if (folderCount == checkedSet.size()) return true; return checkedSet.contains(new PathWrapper(path)); }
TreeCheckState { public boolean isChecked(@NotNull Path path) { Util.checkNotNull(path); if (checkedSet.isEmpty()) return false; if (folderCount == checkedSet.size()) return true; return checkedSet.contains(new PathWrapper(path)); } }
TreeCheckState { public boolean isChecked(@NotNull Path path) { Util.checkNotNull(path); if (checkedSet.isEmpty()) return false; if (folderCount == checkedSet.size()) return true; return checkedSet.contains(new PathWrapper(path)); }  }
TreeCheckState { public boolean isChecked(@NotNull Path path) { Util.checkNotNull(path); if (checkedSet.isEmpty()) return false; if (folderCount == checkedSet.size()) return true; return checkedSet.contains(new PathWrapper(path)); }  boolean isChecked(@NotNull Path path); }
TreeCheckState { public boolean isChecked(@NotNull Path path) { Util.checkNotNull(path); if (checkedSet.isEmpty()) return false; if (folderCount == checkedSet.size()) return true; return checkedSet.contains(new PathWrapper(path)); }  boolean isChecked(@NotNull Path path);  }