Z3
Z3_error_code.java
Go to the documentation of this file.
1 
5 package com.microsoft.z3.enumerations;
6 
7 import java.util.HashMap;
8 import java.util.Map;
9 
13 public enum Z3_error_code {
14  Z3_OK (0),
16  Z3_IOB (2),
27 
28  private final int intValue;
29 
30  Z3_error_code(int v) {
31  this.intValue = v;
32  }
33 
34  // Cannot initialize map in constructor, so need to do it lazily.
35  // Easiest thread-safe way is the initialization-on-demand holder pattern.
36  private static class Z3_error_code_MappingHolder {
37  private static final Map<Integer, Z3_error_code> intMapping = new HashMap<>();
38  static {
39  for (Z3_error_code k : Z3_error_code.values())
40  intMapping.put(k.toInt(), k);
41  }
42  }
43 
44  public static final Z3_error_code fromInt(int v) {
45  Z3_error_code k = Z3_error_code_MappingHolder.intMapping.get(v);
46  if (k != null) return k;
47  throw new IllegalArgumentException("Illegal value " + v + " for Z3_error_code");
48  }
49 
50  public final int toInt() { return this.intValue; }
51 }
52 
static final Z3_error_code fromInt(int v)