Пример #1
0
  /* Get value with given name */
  public Value getValue(String val) {

    for (int i = 0; i < domain.length; i++) if (domain[i].toString().equals(val)) return domain[i];

    Utility.Dprint("Variable.getValue(): Unknown Value: " + val, Utility.TRACE_FUNCTION_LEVEL);
    return null;
  }
Пример #2
0
 public void printVariable() {
   Utility.Dprintc("VARIABLE " + varID + " ", 0);
   for (int j = 0; j < domain.length; j++) {
     Utility.Dprintc(domain[j].toString() + " ", 0);
   }
   Utility.Dprint("", 0);
 }
Пример #3
0
 /* Returns a negative integer, zero, or a positive integer as v1
 is less than, equal to, or greater v2.
 NOTE: assume values are ints.
 */
 public static int compareIntValues(Value val1, Value val2) {
   try {
     int vval1 = new Integer(val1.toString()).intValue();
     int vval2 = new Integer(val2.toString()).intValue();
     if (vval1 > vval2) return 1;
     else if (vval2 > vval1) return -1;
     return 0;
   } catch (Exception e) {
     Utility.Dprint("  Error in Variable.compareValues(): Vals are not ints." + e, 0);
   }
   return 0;
 }