import java.util.regex.Pattern;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
public class LedgerAccount {
static Pattern reHigherAccount = Pattern.compile("^[^:]+:");
this.amounts = new ArrayList<LedgerAmount>();
this.addAmount(amount);
}
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (obj == null) return false;
+
+ return obj.getClass().equals(this.getClass()) &&
+ name.equals(((LedgerAccount) obj).getName());
+ }
// an account is visible if:
// - it is starred (not hidden by a star)
// - and it has an expanded parent or is a top account