| 
  |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ExitCode.java | 0% | 0% | 0% | 0% | 
             | 
  ||||||||||||||
| 1 | package org.sat4j; | |
| 2 | ||
| 3 | /** | |
| 4 | * Enumeration allowing to manage easily exit code for the SAT and PB | |
| 5 | * Competitions. | |
| 6 | * | |
| 7 | * @author leberre | |
| 8 | * | |
| 9 | */ | |
| 10 | public enum ExitCode { | |
| 11 | OPTIMUM_FOUND(30, "OPTIMUM FOUND"), SATISFIABLE(10), UNKNOWN(0), UNSATISFIABLE( //$NON-NLS-1$ | |
| 12 | 20); | |
| 13 | ||
| 14 | /** value of the exit code. */ | |
| 15 | private final int value; | |
| 16 | ||
| 17 | /** alternative textual representation of the exit code. */ | |
| 18 | private final String str; | |
| 19 | ||
| 20 | /** | |
| 21 | * creates an exit code with a given value. | |
| 22 | * | |
| 23 | * @param i | |
| 24 | * the value of the exit code | |
| 25 | */ | |
| 26 | 0 | ExitCode(final int i) { | 
| 27 | 0 | this.value = i; | 
| 28 | 0 | str = null; | 
| 29 | } | |
| 30 | ||
| 31 | /** | |
| 32 | * creates an exit code with a given value and an alternative textual | |
| 33 | * representation. | |
| 34 | * | |
| 35 | * @param i | |
| 36 | * the value of the exit code | |
| 37 | * @param str | |
| 38 | * the alternative textual representation | |
| 39 | */ | |
| 40 | 0 | ExitCode(final int i, final String str) { | 
| 41 | 0 | this.value = i; | 
| 42 | 0 | this.str = str; | 
| 43 | } | |
| 44 | ||
| 45 | /** | |
| 46 | * @return the exit code value | |
| 47 | */ | |
| 48 | 0 | public int value() { | 
| 49 | 0 | return value; | 
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * @return the name of the enum or the alternative textual | |
| 54 | * representation if any. | |
| 55 | */ | |
| 56 | 0 | @Override | 
| 57 | public String toString() { | |
| 58 | 0 | if (str != null) { | 
| 59 | 0 | return str; | 
| 60 | } | |
| 61 | 0 | return super.toString(); | 
| 62 | } | |
| 63 | } | 
  | 
||||||||||