Generated on Thu Nov 2 14:49:35 2006 for Gecode/J by doxygen 1.5.0

NodeStatus.java

Go to the documentation of this file.
00001 /* -*- indent-tabs-mode: nil -*- */
00002 package org.gecode.gist;
00003 
00004 public enum NodeStatus {
00005   FAILED,
00006   SOLVED,
00007   BRANCH,
00008   UNDETERMINED;
00009   
00010   public final int value() {
00011     return value;
00012   }
00013   
00014   public static NodeStatus swigToEnum(int value) {
00015     NodeStatus[] values = NodeStatus.class.getEnumConstants();
00016     if (value < values.length && value >= 0 && values[value].value == value)
00017       return values[value];
00018     for (NodeStatus swigEnum : values)
00019       if (swigEnum.value == value)
00020         return swigEnum;
00021     throw new IllegalArgumentException("No enum " + NodeStatus.class + 
00022                                        " with value " + value);
00023   }
00024   
00025   public static NodeStatus valueOf(org.gecode.SpaceStatus ss) {
00026     switch(ss) {
00027     case SS_FAILED: return FAILED;
00028     case SS_SOLVED: return SOLVED;
00029     case SS_BRANCH: return BRANCH;
00030     }
00031     return UNDETERMINED;
00032   }
00033 
00034   private NodeStatus() {
00035     this.value = Next.next++;
00036   }
00037 
00038   private NodeStatus(int value) {
00039     this.value = value;
00040     Next.next = value+1;
00041   }
00042 
00043   private final int value;
00044 
00045   private static class Next {
00046     private static int next = 0;
00047   }
00048 }
00049