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

io.github.cvc5.UnknownExplanation Maven / Gradle / Ivy

The newest version!
package io.github.cvc5;

import io.github.cvc5.CVC5ApiException;
import java.util.HashMap;
import java.util.Map;

public enum UnknownExplanation
{
  /**
   * Full satisfiability check required (e.g., if only preprocessing was
   * performed).
   */
  REQUIRES_FULL_CHECK(0),
  /**
   * Incomplete theory solver.
   */
  INCOMPLETE(1),
  /**
   * Time limit reached.
   */
  TIMEOUT(2),
  /**
   * Resource limit reached.
   */
  RESOURCEOUT(3),
  /**
   * Memory limit reached.
   */
  MEMOUT(4),
  /**
   * Solver was interrupted.
   */
  INTERRUPTED(5),
  /**
   * Unsupported feature encountered.
   */
  UNSUPPORTED(6),
  /**
   * Other reason.
   */
  OTHER(7),
  /**
   * Requires another satisfiability check
   */
  REQUIRES_CHECK_AGAIN(8),
  /**
   * No specific reason given.
   */
  UNKNOWN_REASON(9),
;

  /* the int value of the UnknownExplanation */
  private int value;
  private static int minValue = 0;
  private static int maxValue = 0;
  private static Map enumMap = new HashMap<>();

  private UnknownExplanation(int value)
  {
    this.value = value;
  }

  static
  {
    boolean firstValue = true;
    for (UnknownExplanation enumerator : UnknownExplanation.values())
    {
      int value = enumerator.getValue();
      if (firstValue)
      {
        minValue = value;
        maxValue = value;
        firstValue = false;
      }
      minValue = Math.min(minValue, value);
      maxValue = Math.max(maxValue, value);
      enumMap.put(value, enumerator);
    }
  }

  public static UnknownExplanation fromInt(int value) throws CVC5ApiException
  {
    if (value < minValue || value > maxValue)
    {
      throw new CVC5ApiException("UnknownExplanation value " + value + " is outside the valid range ["
          + minValue + "," + maxValue + "]");
    }
    return enumMap.get(value);
  }

  public int getValue()
  {
    return value;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy