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

com.github.rickyclarkson.swingflow.Progress Maven / Gradle / Ivy

package com.github.rickyclarkson.swingflow;

import fj.data.Option;

/*
This file was generated based on C:\Users\ricky\swingflow\target\checkout\src\main\jadt\StageProgress.jadt using jADT version null http://jamesiry.github.com/jADT/ . Please do not modify directly.

The source was parsed as: 

package com.github.rickyclarkson.swingflow

import fj.data.Option

Progress =
    InProgress(final int numerator, final int denominator, final String brief, final String detail)
  | Complete(final String brief, final String detail)
  | Failed(final int numerator, final int denominator, final String brief, final String detail)

*/
public abstract class Progress {

   private Progress() {
   }

   public static final  Progress _InProgress(int numerator, int denominator, String brief, String detail) { return new InProgress(numerator, denominator, brief, detail); }
   public static final  Progress _Complete(String brief, String detail) { return new Complete(brief, detail); }
   public static final  Progress _Failed(int numerator, int denominator, String brief, String detail) { return new Failed(numerator, denominator, brief, detail); }

   public static interface MatchBlock {
      ResultType _case(InProgress x);
      ResultType _case(Complete x);
      ResultType _case(Failed x);
   }

   public static abstract class MatchBlockWithDefault implements MatchBlock {
      @Override
      public ResultType _case(InProgress x) { return _default(x); }

      @Override
      public ResultType _case(Complete x) { return _default(x); }

      @Override
      public ResultType _case(Failed x) { return _default(x); }

      protected abstract ResultType _default(Progress x);
   }

   public static interface SwitchBlock {
      void _case(InProgress x);
      void _case(Complete x);
      void _case(Failed x);
   }

   public static abstract class SwitchBlockWithDefault implements SwitchBlock {
      @Override
      public void _case(InProgress x) { _default(x); }

      @Override
      public void _case(Complete x) { _default(x); }

      @Override
      public void _case(Failed x) { _default(x); }

      protected abstract void _default(Progress x);
   }

   public static final class InProgress extends Progress {
      public final int numerator;
      public final int denominator;
      public final String brief;
      public final String detail;

      public InProgress(int numerator, int denominator, String brief, String detail) {
         this.numerator = numerator;
         this.denominator = denominator;
         this.brief = brief;
         this.detail = detail;
      }

      @Override
      public  ResultType match(MatchBlock matchBlock) { return matchBlock._case(this); }

      @Override
      public void _switch(SwitchBlock switchBlock) { switchBlock._case(this); }

      @Override
      public int hashCode() {
          final int prime = 31;
          int result = 1;
          result = prime * result + numerator;
          result = prime * result + denominator;
          result = prime * result + ((brief == null) ? 0 : brief.hashCode());
          result = prime * result + ((detail == null) ? 0 : detail.hashCode());
          return result;
      }

      @Override
      public boolean equals(Object obj) {
         if (this == obj) return true;
         if (obj == null) return false;
         if (getClass() != obj.getClass()) return false;
         InProgress other = (InProgress)obj;
         if (numerator != other.numerator) return false;
         if (denominator != other.denominator) return false;
         if (brief == null) {
            if (other.brief != null) return false;
         } else if (!brief.equals(other.brief)) return false;
         if (detail == null) {
            if (other.detail != null) return false;
         } else if (!detail.equals(other.detail)) return false;
         return true;
      }

      @Override
      public String toString() {
         return "InProgress(numerator = " + numerator + ", denominator = " + denominator + ", brief = " + brief + ", detail = " + detail + ")";
      }

   }

   public static final class Complete extends Progress {
      public final String brief;
      public final String detail;

      public Complete(String brief, String detail) {
         this.brief = brief;
         this.detail = detail;
      }

      @Override
      public  ResultType match(MatchBlock matchBlock) { return matchBlock._case(this); }

      @Override
      public void _switch(SwitchBlock switchBlock) { switchBlock._case(this); }

      @Override
      public int hashCode() {
          final int prime = 31;
          int result = 1;
          result = prime * result + ((brief == null) ? 0 : brief.hashCode());
          result = prime * result + ((detail == null) ? 0 : detail.hashCode());
          return result;
      }

      @Override
      public boolean equals(Object obj) {
         if (this == obj) return true;
         if (obj == null) return false;
         if (getClass() != obj.getClass()) return false;
         Complete other = (Complete)obj;
         if (brief == null) {
            if (other.brief != null) return false;
         } else if (!brief.equals(other.brief)) return false;
         if (detail == null) {
            if (other.detail != null) return false;
         } else if (!detail.equals(other.detail)) return false;
         return true;
      }

      @Override
      public String toString() {
         return "Complete(brief = " + brief + ", detail = " + detail + ")";
      }

   }

   public static final class Failed extends Progress {
      public final int numerator;
      public final int denominator;
      public final String brief;
      public final String detail;

      public Failed(int numerator, int denominator, String brief, String detail) {
         this.numerator = numerator;
         this.denominator = denominator;
         this.brief = brief;
         this.detail = detail;
      }

      @Override
      public  ResultType match(MatchBlock matchBlock) { return matchBlock._case(this); }

      @Override
      public void _switch(SwitchBlock switchBlock) { switchBlock._case(this); }

      @Override
      public int hashCode() {
          final int prime = 31;
          int result = 1;
          result = prime * result + numerator;
          result = prime * result + denominator;
          result = prime * result + ((brief == null) ? 0 : brief.hashCode());
          result = prime * result + ((detail == null) ? 0 : detail.hashCode());
          return result;
      }

      @Override
      public boolean equals(Object obj) {
         if (this == obj) return true;
         if (obj == null) return false;
         if (getClass() != obj.getClass()) return false;
         Failed other = (Failed)obj;
         if (numerator != other.numerator) return false;
         if (denominator != other.denominator) return false;
         if (brief == null) {
            if (other.brief != null) return false;
         } else if (!brief.equals(other.brief)) return false;
         if (detail == null) {
            if (other.detail != null) return false;
         } else if (!detail.equals(other.detail)) return false;
         return true;
      }

      @Override
      public String toString() {
         return "Failed(numerator = " + numerator + ", denominator = " + denominator + ", brief = " + brief + ", detail = " + detail + ")";
      }

   }

   public abstract  ResultType match(MatchBlock matchBlock);

   public abstract void _switch(SwitchBlock switchBlock);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy