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

com.github.dakusui.enumerator.tuple.AttrValue Maven / Gradle / Ivy

package com.github.dakusui.enumerator.tuple;

public class AttrValue {
  private final T attr;
  private final U value;

  public AttrValue(T attr, U value) {
    this.attr = attr;
    this.value = value;
  }

  public T attr() {
    return this.attr;
  }

  public U value() {
    return this.value;
  }

  @Override
  public int hashCode() {
    return ((this.attr == null) ? 0 : this.attr.hashCode())
        + ((this.value == null) ? 0 : this.value.hashCode());
  }

  @Override
  public boolean equals(Object anotherObject) {
    if (!(anotherObject instanceof AttrValue))
      return false;
    @SuppressWarnings("unchecked")
    AttrValue another = (AttrValue) anotherObject;
    return (this.value == null) ? value == null : this.value
        .equals(another.value) && (this.attr == null) ? attr == null
        : this.attr.equals(another.attr);
  }

  public String toString() {
    return "(" + this.attr + "," + this.value + ")";
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy