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

hydra.langs.haskell.ast.Assertion Maven / Gradle / Ivy

package hydra.langs.haskell.ast;

import java.io.Serializable;

/**
 * A type assertion
 */
public abstract class Assertion implements Serializable {
  public static final hydra.core.Name NAME = new hydra.core.Name("hydra/langs/haskell/ast.Assertion");
  
  private Assertion () {
  
  }
  
  public abstract  R accept(Visitor visitor) ;
  
  public interface Visitor {
    R visit(Class_ instance) ;
    
    R visit(Tuple instance) ;
  }
  
  public interface PartialVisitor extends Visitor {
    default R otherwise(Assertion instance) {
      throw new IllegalStateException("Non-exhaustive patterns when matching: " + (instance));
    }
    
    default R visit(Class_ instance) {
      return otherwise((instance));
    }
    
    default R visit(Tuple instance) {
      return otherwise((instance));
    }
  }
  
  public static final class Class_ extends hydra.langs.haskell.ast.Assertion implements Serializable {
    public final hydra.langs.haskell.ast.Assertion_Class value;
    
    public Class_ (hydra.langs.haskell.ast.Assertion_Class value) {
      this.value = value;
    }
    
    @Override
    public boolean equals(Object other) {
      if (!(other instanceof Class_)) {
        return false;
      }
      Class_ o = (Class_) (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 Tuple extends hydra.langs.haskell.ast.Assertion implements Serializable {
    public final java.util.List value;
    
    public Tuple (java.util.List value) {
      this.value = value;
    }
    
    @Override
    public boolean equals(Object other) {
      if (!(other instanceof Tuple)) {
        return false;
      }
      Tuple o = (Tuple) (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