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; } }
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); } }
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); } }
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); } }
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 + ")"); } }
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); } }