+ return obj.getClass().equals(this.getClass()) &&
+ name.equals(((LedgerAccount) obj).getName());
+ }
+ // an account is visible if:
+ // - it has an expanded parent or is a top account
+ public boolean isVisible(List<LedgerAccount> list) {
+ for (LedgerAccount acc : list) {
+ if (acc.isParentOf(this)) {
+ if (!acc.isExpanded()) return false;
+ }
+ }
+ return true;
+ }
+ public boolean isParentOf(LedgerAccount potentialChild) {
+ return potentialChild.getName().startsWith(name + ":");
+ }