Exemplo n.º 1
0
 private static Type type(DSHandle l, DSHandle r) throws ExecutionException {
   Type tl = l.getType();
   Type tr = r.getType();
   if (Types.STRING.equals(tl) || Types.STRING.equals(tr)) {
     return Types.STRING;
   } else if (Types.FLOAT.equals(tl) || Types.FLOAT.equals(tr)) {
     return Types.FLOAT;
   } else {
     return Types.INT;
   }
 }
Exemplo n.º 2
0
 private static void logUnaryProvenance(String name, DSHandle v, DSHandle r)
     throws ExecutionException {
   if (PROVENANCE_ENABLED) {
     String thread = SwiftFunction.getThreadPrefix();
     String vid = v.getIdentifier();
     String rid = r.getIdentifier();
     provenanceLogger.info(
         "UNARYOPERATOR thread="
             + thread
             + " operator="
             + name
             + " operand="
             + vid
             + " result="
             + rid);
   }
 }
Exemplo n.º 3
0
 private static boolean getBool(Node n, DSHandle h) {
   waitFor(n, h);
   Object v = h.getValue();
   if (v instanceof Boolean) {
     return ((Boolean) v).booleanValue();
   } else {
     throw new ExecutionException(n, "Internal error. Expected float: " + h);
   }
 }
Exemplo n.º 4
0
 private static double getFloat(Node n, DSHandle h) {
   waitFor(n, h);
   Object v = h.getValue();
   if (v instanceof Number) {
     return ((Number) v).doubleValue();
   } else {
     throw new ExecutionException(n, "Internal error. Expected float: " + h);
   }
 }
Exemplo n.º 5
0
 private static int getInt(Node n, DSHandle h) {
   waitFor(n, h);
   Object v = h.getValue();
   if (v instanceof Integer) {
     return ((Integer) v).intValue();
   } else {
     throw new ExecutionException(n, "Internal error. Expected an int: " + v + " (" + h + ")");
   }
 }
Exemplo n.º 6
0
 private static void logBinaryProvenance(String name, DSHandle v1, DSHandle v2, DSHandle result)
     throws ExecutionException {
   if (PROVENANCE_ENABLED) {
     String thread = SwiftFunction.getThreadPrefix();
     String lhsid = v1.getIdentifier();
     String rhsid = v2.getIdentifier();
     String rid = result.getIdentifier();
     provenanceLogger.info(
         "OPERATOR thread="
             + thread
             + " operator="
             + name
             + " lhs="
             + lhsid
             + " rhs="
             + rhsid
             + " result="
             + rid);
   }
 }