case TASKSETUPTIME: task = (Task) args[0].getResult (data); if (task == null) return null; a2 = task.getAssignment(); return (a2 == null) ? null : reuse.getInteger (a2.getStartTime());  case TASKWRAPUPTIME: task = (Task) args[0].getResult (data); if (task == null) return null; a2 = task.getAssignment(); return (a2 == null) ? null : reuse.getInteger (a2.getEndTime());
  public Object getResult (Map data) {    ArrayList list;    Object res;    Object var;    SchObject obj;    Object obj1, obj2;    Assignment[] a;    Assignment a2;    Resource resource;    Task task;    ArrayList lres;    if (operation == -1) {      System.out.println        ("Operator.getResult - No operation specified for operator?");      return FALSE;    }    switch (operation) {    case EQ:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      return obj1.equals (obj2) ? TRUE : FALSE;    case NE:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      return obj1.equals (obj2) ? FALSE : TRUE;    case LT:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      if (obj1 instanceof Reusable.RFloat)        return (((Reusable.RFloat) obj1).floatValue() <                ((Reusable.RFloat) obj2).floatValue() ?                TRUE : FALSE);      else if (obj1 instanceof Reusable.RInteger)        return (((Reusable.RInteger) obj1).intValue() <                ((Reusable.RInteger) obj2).intValue() ?                TRUE : FALSE);      else        return FALSE;    case GT:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      if (obj1 instanceof Reusable.RFloat)        return (((Reusable.RFloat) obj1).floatValue() >                ((Reusable.RFloat) obj2).floatValue() ?                TRUE : FALSE);      else if (obj1 instanceof Reusable.RInteger)        return (((Reusable.RInteger) obj1).intValue() >                ((Reusable.RInteger) obj2).intValue() ?                TRUE : FALSE);      else        return FALSE;    case LE:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      if (obj1 instanceof Reusable.RFloat)        return (((Reusable.RFloat) obj1).floatValue() <=                ((Reusable.RFloat) obj2).floatValue() ?                TRUE : FALSE);      else if (obj1 instanceof Reusable.RInteger)        return (((Reusable.RInteger) obj1).intValue() <=                ((Reusable.RInteger) obj2).intValue() ?                TRUE : FALSE);      else        return FALSE;    case GE:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      if (obj1 instanceof Reusable.RFloat)        return (((Reusable.RFloat) obj1).floatValue() >=                ((Reusable.RFloat) obj2).floatValue() ?                TRUE : FALSE);      else if (obj1 instanceof Reusable.RInteger)        return (((Reusable.RInteger) obj1).intValue() >=                ((Reusable.RInteger) obj2).intValue() ?                TRUE : FALSE);      else        return FALSE;    case AND:      for (int i = 0; i < args.length; i++) {        obj1 = args[i].getResult (data);        if (obj1 == null)          return null;        if (! ((Boolean) obj1).booleanValue())          return FALSE;      }      return TRUE;    case OR:      for (int i = 0; i < args.length; i++) {        obj1 = args[i].getResult (data);        if (obj1 == null)          return null;        if (((Boolean) obj1).booleanValue())          return TRUE;      }      return FALSE;    case NOT:      obj1 = args[0].getResult (data);      if (obj1 == null)        return null;      return ((Boolean) obj1).booleanValue() ? FALSE : TRUE;    case PLUS:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      if (obj1 instanceof Reusable.RInteger)        return reuse.getInteger          (((Reusable.RInteger) obj1).intValue() +           ((int) ((Reusable.RFloat) obj2).floatValue()));      else if (obj2 instanceof Reusable.RInteger)        return reuse.getInteger          (((int) ((Reusable.RFloat) obj1).floatValue()) +           ((Reusable.RInteger) obj2).intValue());      else        return reuse.getFloat (((Reusable.RFloat) obj1).floatValue() +                               ((Reusable.RFloat) obj2).floatValue());    case MINUS:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      if (obj2 instanceof Reusable.RInteger)        return reuse.getFloat          ((float) (((Reusable.RInteger) obj1).intValue() -                    ((Reusable.RInteger) obj2).intValue()));      else if (obj1 instanceof Reusable.RFloat)        return reuse.getFloat (((Reusable.RFloat) obj1).floatValue() -                               ((Reusable.RFloat) obj2).floatValue());      else        return reuse.getInteger          (((Reusable.RInteger) obj1).intValue() -           ((int) ((Reusable.RFloat) obj2).floatValue()));    case TIMES:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      return reuse.getFloat (((Reusable.RFloat) obj1).floatValue() *                             ((Reusable.RFloat) obj2).floatValue());    case DIVIDE:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      return reuse.getFloat (((Reusable.RFloat) obj1).floatValue() /                             ((Reusable.RFloat) obj2).floatValue());    case MOD:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      return reuse.getFloat (((Reusable.RFloat) obj1).floatValue() %                             ((Reusable.RFloat) obj2).floatValue());    case ABS:      obj1 = args[0].getResult (data);      if (obj1 == null)        return null;      return reuse.getFloat        (Math.abs (((Reusable.RFloat) obj1).floatValue()));    case IF:      obj1 = args[0].getResult (data);      if (obj1 == null)        return null;      if (!((Boolean) obj1).booleanValue() && (args.length == 2))	return null;      else        return args[((Boolean) obj1).booleanValue() ? 1 : 2].getResult (data);    case MAX:      float max = Float.MIN_VALUE;      for (int i = 0; i < args.length; i++) {        Reusable.RFloat f = (Reusable.RFloat) args[i].getResult (data);        if ((f != null) && (f.floatValue() > max))          max = f.floatValue();      }      return (max == Float.MIN_VALUE) ? null : reuse.getFloat (max);    case MIN:      float min = Float.MAX_VALUE;      for (int i = 0; i < args.length; i++) {        Reusable.RFloat f = (Reusable.RFloat) args[i].getResult (data);        if ((f != null) && (f.floatValue() < min))          min = f.floatValue();      }      return (min == Float.MAX_VALUE) ? null : reuse.getFloat (min);    case MAXOVER:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      res = null;      var = args[1].getResult (data);      if (var == null)        return null;      for (int i = 0; i < list.size(); i++) {        data.put (var, list.get(i));        Object val = args[2].getResult (data);        if (val == null)          continue;        if (val instanceof Reusable.RFloat) {          if ((res == null) ||              (((Reusable.RFloat) val).floatValue() >               ((Reusable.RFloat) res).floatValue()))            res = val;        }        else if (val instanceof Reusable.RInteger) {          if ((res == null) ||              (((Reusable.RInteger) val).intValue() >               ((Reusable.RInteger) res).intValue()))            res = val;        }      }      data.remove (var);      return res;    case MINOVER:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      res = null;      var = args[1].getResult (data);      if (var == null)        return null;      for (int i = 0; i < list.size(); i++) {        data.put (var, list.get(i));        Object val = args[2].getResult (data);        if (val == null)          continue;        if (val instanceof Reusable.RFloat) {          if ((res == null) ||              (((Reusable.RFloat) val).floatValue() <               ((Reusable.RFloat) res).floatValue()))            res = val;        }        else if (val instanceof Reusable.RInteger) {          if ((res == null) ||              (((Reusable.RInteger) val).intValue() <               ((Reusable.RInteger) res).intValue()))            res = val;        }      }      data.remove (var);      return res;    case SUMOVER:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      var = args[1].getResult (data);      if (var == null)        return null;      float fres = 0.0f;      for (int i = 0; i < list.size(); i++) {        data.put (var, list.get(i));        Object val = args[2].getResult (data);        if (val != null)          fres += ((Reusable.RFloat) val).floatValue();      }      data.remove (var);      return reuse.getFloat (fres);    case ANDOVER:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      var = args[1].getResult (data);      if (var == null)        return null;      for (int i = 0; i < list.size(); i++) {        data.put (var, list.get(i));        Boolean val = (Boolean) args[2].getResult (data);        if ((val != null) && (! val.booleanValue())) {          data.remove (var);          return FALSE;        }      }      data.remove (var);      return TRUE;    case OROVER:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      var = args[1].getResult (data);      if (var == null)        return null;      for (int i = 0; i < list.size(); i++) {        data.put (var, list.get(i));        Boolean val = (Boolean) args[2].getResult (data);        if ((val != null) && val.booleanValue()) {          data.remove (var);          return TRUE;        }      }      data.remove (var);      return FALSE;    case MAPOVER:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      var = args[1].getResult (data);      if (var == null)        return null;      lres = reuse.getList();      for (int i = 0; i < list.size(); i++) {        data.put (var, list.get(i));        Object val = args[2].getResult (data);        if (val == null)          continue;        if (val instanceof ArrayList)          lres.addAll ((ArrayList) val);        else          lres.add (val);      }      data.remove (var);      return lres;    case LOOP:      Reusable.RFloat num = (Reusable.RFloat) args[0].getResult (data);      if (num == null)        return null;      var = args[1].getResult (data);      if (var == null)        return null;      lres = reuse.getList();      for (int i = 1; i <= num.intValue(); i++) {        data.put (var, reuse.getFloat ((float) i));        Object val = args[2].getResult (data);        if (val == null)          continue;        if (val instanceof ArrayList)          lres.addAll ((ArrayList) val);        else          lres.add (val);      }      data.remove (var);      return lres;    case LENGTH:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      return reuse.getFloat (list.size());    case POSITION:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      obj1 = args[1].getResult (data);      if (obj1 == null)        return null;      int index = list.indexOf (obj1);      if (index == -1)        return null;      return reuse.getFloat (index + 1);    case LIST:      list = reuse.getList();      for (int i = 0; i < args.length; i++) {        Object o1 = args[i].getResult (data);        if (o1 != null)          list.add (o1);      }      return list;    case DIST:      SchObject sobj1 = (SchObject) args[0].getResult (data);      SchObject sobj2 = (SchObject) args[1].getResult (data);      if ((sobj1 == null) || (sobj2 == null))        return null;      if (argTypes[0].equals ("xy_coord")) {        float xdiff = (((Reusable.RFloat) sobj1.getField ("x")).floatValue() -                       ((Reusable.RFloat) sobj2.getField ("x")).floatValue());        float ydiff = (((Reusable.RFloat) sobj1.getField ("y")).floatValue() -                       ((Reusable.RFloat) sobj2.getField ("y")).floatValue());        double distval = Math.sqrt ((double) (xdiff * xdiff + ydiff * ydiff));        return reuse.getFloat ((float) distval);      }      if (argTypes[0].equals ("latlong")) {        float lat1 = (((Reusable.RFloat) sobj1.getField ("latitude")).                      floatValue() * DEGREES_TO_RADIANS);        float lat2 = (((Reusable.RFloat) sobj2.getField ("latitude")).                      floatValue() * DEGREES_TO_RADIANS);        float dlong = (((Reusable.RFloat) sobj1.getField ("longitude")).                       floatValue() -                       ((Reusable.RFloat) sobj2.getField ("longitude")).                       floatValue()) * DEGREES_TO_RADIANS;        double rads =          Math.acos (Math.sin ((double) lat1) * Math.sin ((double) lat2) +                     Math.cos ((double) lat1) * Math.cos ((double) lat2) *                     Math.cos ((double) dlong));        return reuse.getFloat (EARTH_RADIUS * (float) rads);      }      return null;    case LATLONG_OP:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      obj = new SchObject (timeOps);      obj.addField ("latitude", "", ((Reusable.RFloat) obj1).copy(),                    false, false);      obj.addField ("longitude", "", ((Reusable.RFloat) obj2).copy(),                    false, false);      return obj;    case XY_COORD_OP:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      obj = new SchObject (timeOps);      obj.addField ("x", "", ((Reusable.RFloat) obj1).copy(), false, false);      obj.addField ("y", "", ((Reusable.RFloat) obj2).copy(), false, false);      return obj;    case INTERVAL_OP:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      obj = new SchObject (timeOps);      obj.addField ("start", "", ((Reusable.RInteger) obj1).copy(),                    false, false);      obj.addField ("end", "", ((Reusable.RInteger) obj2).copy(),                    false, false);      if (argTypes.length > 2)        obj.addField ("label1", "string", args[2].getResult (data),                      false, false);      if (argTypes.length > 3)        obj.addField ("label2", "string", args[3].getResult (data),                      false, false);      return obj;    case GET:      obj = (SchObject) args[0].getResult (data);      if (obj == null)        return null;      return obj.getField ((String) args[1].getResult (data));    case STRING:      obj1 = args[0].getResult (data);      if (obj1 == null)        return null;      return SchedulingSpecs.stringForObject (obj1);    case GLOBALGET:      obj = (SchObject) args[0].getResult (data);      if (obj == null)        return null;      String str = (String) obj.getField ((String) args[1].getResult (data));      return (argTypes[2].equals (sdata.typeForGlobal (str)) ?              data.get (str) : null);    case ENTRY:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      obj2 = args[1].getResult (data);      if (obj2 == null)        return null;      int entry = ((Reusable.RFloat) obj2).intValue() - 1;      try {        return list.get (entry);      } catch (IndexOutOfBoundsException e) {        return null;      }    case MATENTRY:      obj = (SchObject) args[0].getResult (data);      if (obj == null)        return null;      obj1 = args[1].getResult (data);      obj2 = args[2].getResult (data);      if ((obj1 == null) || (obj2 == null))        return null;      int row = ((Reusable.RFloat) obj1).intValue() - 1;      int col = ((Reusable.RFloat) obj2).intValue() - 1;      int entry2 = col + row *        ((Reusable.RFloat) obj.getField ("numcols")).intValue();      return ((ArrayList) obj.getField ("values")).get (entry2);    case BUSYTIME:      resource = (Resource) args[0].getResult (data);      if (resource == null)        return null;      obj1 = args[1].getResult (data);      obj2 = args[2].getResult (data);      int start = ((obj1 == null) ? Integer.MIN_VALUE :                   ((Reusable.RInteger) obj1).intValue());      int end = ((obj2 == null) ? Integer.MAX_VALUE :                 ((Reusable.RInteger) obj2).intValue());      return reuse.getFloat (resource.busyTime (start, end));    case PREPTIME:      resource = (Resource) args[0].getResult (data);      if (resource == null)        return null;      return reuse.getFloat (resource.prepTime());    case COMPLETE:      resource = (Resource) args[0].getResult (data);      if (resource == null)        return null;      a = resource.getAssignments();      int imax = Integer.MIN_VALUE;      for (int i = 0; i < a.length; i++) {        int wrapup2 = a[i].getEndTime();        if (imax < wrapup2)          imax = wrapup2;      }      return ((imax == Integer.MIN_VALUE) ?              data.get ("start_time") : reuse.getInteger (imax));    case TASKSTARTTIME:      task = (Task) args[0].getResult (data);      if (task == null)        return null;      a2 = task.getAssignment();      return (a2 == null) ? null : reuse.getInteger (a2.getTaskStartTime());    case TASKENDTIME:      task = (Task) args[0].getResult (data);      if (task == null)        return null;      a2 = task.getAssignment();      return (a2 == null) ? null : reuse.getInteger (a2.getTaskEndTime());    case RESOURCEFOR:      task = (Task) args[0].getResult (data);      if (task == null)        return null;      a2 = task.getAssignment();      return (a2 == null) ? null : a2.getResource();    case TASKSFOR:      resource = (Resource) args[0].getResult (data);      if (resource == null)        return null;      a = resource.getAssignments();      list = reuse.getList();      for (int i = 0; i < a.length; i++)        list.add (a[i].getTask());      return list;    case GROUPFOR:      task = (Task) args[0].getResult (data);      if (task == null)        return null;      a2 = task.getAssignment();      if (a2 == null)        return null;      return a2.getResource().getGroup (reuse.getList(), task);    case PREVIOUSDELTA:      resource = (Resource) args[0].getResult (data);      if (resource == null)        return null;      return reuse.getFloat (resource.getSumOfDeltas());    case HASVALUE:      obj1 = args[0].getResult (data);      return (obj1 != null) ? TRUE : FALSE;    case FIND:      list = (ArrayList) args[0].getResult (data);      if (list == null)        return null;      var = args[1].getResult (data);      if (var == null)        return null;      Object findres = null;      for (int i = 0; i < list.size(); i++) {        data.put (var, list.get(i));        Boolean val = (Boolean) args[2].getResult (data);        if (val == null)          continue;        if (val.booleanValue()) {          findres = list.get(i);          break;        }      }      data.remove (var);      return findres;    case APPEND:      obj1 = args[0].getResult (data);      obj2 = args[1].getResult (data);      if (obj1 == null)        return obj2;      if (obj2 == null)        return obj1;      if (argTypes[0].equals ("string"))        return ((String) obj1) + ((String) obj2);      lres = reuse.getList();      lres.addAll ((ArrayList) obj1);      lres.addAll ((ArrayList) obj2);      return lres;    default:      System.out.println ("Unimplemented operation " + opStrings[operation]);      return FALSE;    }  }