App
InterpolatorType.java
Go to the documentation of this file.
1 package mhr.appcore.interpolators;
2 
6 public enum InterpolatorType {
7 
8  INVALID_TYPE(0), NEAREST_NEIGHBOUR(1), LINEAR_INTERPOLATOR(2), CUBIC_INTERPOLATOR(3);
9 
10  private static final InterpolatorType[] lut = new InterpolatorType[5];
11  static {
12  for (InterpolatorType type : InterpolatorType.values()) {
13  lut[type.getValue()] = type;
14  }
15  }
16 
17  private final int nativeEnumValue;
18 
23  private InterpolatorType(int nativeEnumValue) {
24  this.nativeEnumValue = nativeEnumValue;
25  }
26 
31  public int getValue() {
32  return nativeEnumValue;
33  }
34 
40  public static InterpolatorType fromValue(int nativeValue) {
41  try {
42  return lut[nativeValue];
43  } catch (IndexOutOfBoundsException exc) {
45  }
46  }
47 }