コード例 #1
0
 /**
  * Converts an <code>int</code> value to an <code>EdgeTriggeredAlarmDirection instance</code>. If
  * the <code>int</code> value is out of range it returns <code>null</code>.
  *
  * @param i The <code>int</code> value
  * @return The <code>EdgeTriggeredAlarmDirection</code> representation of the <code>int</code>
  *     value
  */
 public static final EdgeTriggeredAlarmDirection intToEnum(final int i) {
   try {
     return EdgeTriggeredAlarmDirection.values()[i];
   } catch (ArrayIndexOutOfBoundsException e) {
     return null;
   }
 }
コード例 #2
0
 /**
  * Converts this <code>EdgeTriggeredAlarmDirection</code> instance to an <code>int</code> value.
  *
  * @return <code>int</code> representation of this <code>EdgeTriggeredAlarmDirection</code>
  *     instance
  */
 public final int toInt() {
   EdgeTriggeredAlarmDirection[] values = EdgeTriggeredAlarmDirection.values();
   for (int index = 0; index < values.length; index++) {
     if (values[index] == this) return index;
   }
   return -1;
 }