public boolean equals(Object other) { if (other instanceof Coset) { final Coset coset = (Coset) other; return this.getAction() == coset.getAction() && this.getIndex() == coset.getIndex(); } else { return false; } }
public Object apply(final Object x, final FreeWord w) { if (!(x instanceof Coset)) { return null; } final Coset coset = (Coset) x; if (coset.getAction() != this) { return null; } int current = coset.getIndex(); if (current < 1 || current > size()) { return null; } for (int i = 0; i < w.length(); ++i) { final Integer j = (Integer) this.gen2idx.get(w.subword(i, i + 1)); if (j == null) { return null; } else { final int row[] = (int[]) this.table.get(current); current = row[j.intValue()]; } } return new Coset(current); }