package jetbrains.mps.baseLanguage.typesystem;

/*Generated by MPS */

import org.jetbrains.mps.annotations.Immutable;
import jetbrains.mps.references.Reference;
import java.util.Objects;

@Immutable
/*package*/ final class Signature {
  private String myName;
  public String getName() {
    return this.myName;
  }
  private void _setName(String value) {
    this.myName = value;
  }
  private String setName(String value) {
    _setName(value);
    return value;
  }
  private Reference<String> refToName() {
    return new Reference<String>() {
      public String get() {
        return getName();
      }
      public void set(String value) {
        _setName(value);
      }
    };
  }
  private int myParamsCount;
  public int getParamsCount() {
    return this.myParamsCount;
  }
  private void _setParamsCount(int value) {
    this.myParamsCount = value;
  }
  private int setParamsCount(int value) {
    _setParamsCount(value);
    return value;
  }
  private Reference<Integer> refToParamsCount() {
    return new Reference<Integer>() {
      public Integer get() {
        return getParamsCount();
      }
      public void set(Integer value) {
        _setParamsCount(value);
      }
    };
  }
  private String myParamsErasure;
  public String getParamsErasure() {
    return this.myParamsErasure;
  }
  private void _setParamsErasure(String value) {
    this.myParamsErasure = value;
  }
  private String setParamsErasure(String value) {
    _setParamsErasure(value);
    return value;
  }
  private Reference<String> refToParamsErasure() {
    return new Reference<String>() {
      public String get() {
        return getParamsErasure();
      }
      public void set(String value) {
        _setParamsErasure(value);
      }
    };
  }

  /*package*/ Signature(String name, int paramsCount, String paramsErasure) {
    this.setName(name);
    this.setParamsCount(paramsCount);
    this.setParamsErasure(paramsErasure);
  }

  public static Signature create(String name, int paramsCount, String paramsErasure) {
    return new Signature(name, paramsCount, paramsErasure);
  }

  @Override
  public int hashCode() {
    return Objects.hash(getName(), getParamsCount(), getParamsErasure());
  }

  @Override
  public boolean equals(Object object) {
    if (!(object instanceof Signature)) {
      return false;
    }
    Signature another = (Signature) object;
    return Objects.equals(getName(), another.getName()) && Objects.equals(getParamsCount(), another.getParamsCount()) && Objects.equals(getParamsErasure(), another.getParamsErasure());
  }
}
