All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.isi.nlp.collections.AbstractMultitable Maven / Gradle / Ivy

The newest version!
package edu.isi.nlp.collections;

import javax.annotation.Nullable;

/**
 * Abstract class for implementing {@link Multitable}s which satisfy the {@link #equals(Object)} and
 * {@link #hashCode()} contract.
 *
 * @author Chester Palen-Michel, Constantine Lignos, Ryan Gabbard
 */
public abstract class AbstractMultitable implements Multitable {
  @Override
  public final int hashCode() {
    return cellSet().hashCode();
  }

  @Override
  public final boolean equals(@Nullable Object obj) {
    if (obj == this) {
      return true;
    } else if (obj instanceof Multitable) {
      final Multitable that = (Multitable) obj;
      return this.cellSet().equals(that.cellSet());
    } else {
      return false;
    }
  }

  @Override
  public String toString() {
    return rowMap().toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy