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

hydra.langs.scala.meta.Name Maven / Gradle / Ivy

package hydra.langs.scala.meta;

import java.io.Serializable;

public abstract class Name implements Serializable {
  public static final hydra.core.Name NAME = new hydra.core.Name("hydra/langs/scala/meta.Name");
  
  private Name () {
  
  }
  
  public abstract  R accept(Visitor visitor) ;
  
  public interface Visitor {
    R visit(Value instance) ;
    
    R visit(Anonymous instance) ;
    
    R visit(Indeterminate instance) ;
  }
  
  public interface PartialVisitor extends Visitor {
    default R otherwise(Name instance) {
      throw new IllegalStateException("Non-exhaustive patterns when matching: " + (instance));
    }
    
    default R visit(Value instance) {
      return otherwise((instance));
    }
    
    default R visit(Anonymous instance) {
      return otherwise((instance));
    }
    
    default R visit(Indeterminate instance) {
      return otherwise((instance));
    }
  }
  
  public static final class Value extends hydra.langs.scala.meta.Name implements Serializable {
    public final String value;
    
    public Value (String value) {
      this.value = value;
    }
    
    @Override
    public boolean equals(Object other) {
      if (!(other instanceof Value)) {
        return false;
      }
      Value o = (Value) (other);
      return value.equals(o.value);
    }
    
    @Override
    public int hashCode() {
      return 2 * value.hashCode();
    }
    
    @Override
    public  R accept(Visitor visitor) {
      return visitor.visit(this);
    }
  }
  
  public static final class Anonymous extends hydra.langs.scala.meta.Name implements Serializable {
    public Anonymous () {
    
    }
    
    @Override
    public boolean equals(Object other) {
      if (!(other instanceof Anonymous)) {
        return false;
      }
      Anonymous o = (Anonymous) (other);
      return true;
    }
    
    @Override
    public int hashCode() {
      return 0;
    }
    
    @Override
    public  R accept(Visitor visitor) {
      return visitor.visit(this);
    }
  }
  
  public static final class Indeterminate extends hydra.langs.scala.meta.Name implements Serializable {
    public final hydra.langs.scala.meta.PredefString value;
    
    public Indeterminate (hydra.langs.scala.meta.PredefString value) {
      this.value = value;
    }
    
    @Override
    public boolean equals(Object other) {
      if (!(other instanceof Indeterminate)) {
        return false;
      }
      Indeterminate o = (Indeterminate) (other);
      return value.equals(o.value);
    }
    
    @Override
    public int hashCode() {
      return 2 * value.hashCode();
    }
    
    @Override
    public  R accept(Visitor visitor) {
      return visitor.visit(this);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy