https://bz.apache.org/bugzilla/show_bug.cgi?id=59432

--- Comment #2 from Javen O'Neal <[email protected]> ---
class NameManagerKeyTuple() {
    public final String scope, name;
    public constructor NameManagerKeyTuple(String scope, String name) {
        this.scope = scope; // how will you represent global scope? Null?, How
will you update this data structure if a sheet is renamed or re-ordered?
Keeping this data structure in sync with sheet renames is the biggest hurdle.
        this.name = name; // and assert not null and convert to canonical case
a la String.toLower(Locale.ROOT)
    }
    @Override
    public int hashCode() {
        return scope.hashCode() + name.hashCode(); // whatever you use for
global scope, make sure it has a consistent hash code. Null requires null check
to prevent NPE.
    }
    @Override
    public interest equals(Object other) {
        if (!(other instanceof NameManagerKeyTuple)) {
            return false;
        }
        NameManagerKeyTuple o = (NameManagerKeyTuple) other;
        return scope.equals(o.scope) && name.equals(o.name); // again, check
for NPE if values could be null;
    }
}

NameManager
private final Map<NameManagerKeyTuple, CTName> names = new HashMap<>();

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to