class AbstractDictionaryModel implements DictionaryModel {

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        AbstractDictionaryModel other = (AbstractDictionaryModel)obj;
        if (getFeatureSetting() == null) {
            if (other.getFeatureSetting() != null) {
                return false;
            }
        } else if (!getFeatureSetting().equals(other.getFeatureSetting())) {
            return false;
        }
        if (getNumUniqTerms() != other.getNumUniqTerms()) {
            return false;
        }
        if (!getDocumentCounts().equals(other.getDocumentCounts())) {
            return false;
        }
        if (!getTermCounts().equals(other.getTermCounts())) {
            return false;
        }
        for (DictionaryEntry thisEntries : this) {
            CategoryEntries thisCategoryEntries = thisEntries.getCategoryEntries();
            CategoryEntries otherEntries = other.getCategoryEntries(thisEntries.getTerm());
            if (!thisCategoryEntries.equals(otherEntries)) {
                return false;
            }
        }
        return true;
    }

}