@Override protected DSHandle value(AbstractDataNode v1, AbstractDataNode v2) { Type t = type(v1, v2); DSHandle r; try { if (t == Types.INT) { r = NodeFactory.newRoot(Field.GENERIC_INT, getInt(this, v1) % getInt(this, v2)); } else { r = NodeFactory.newRoot(Field.GENERIC_FLOAT, getFloat(this, v1) % getFloat(this, v2)); } logBinaryProvenance("remainder", v1, v2, r); return r; } catch (DependentException e) { return NodeFactory.newRoot(Field.Factory.getImmutableField("?", t), e); } }
@Override protected DSHandle value(AbstractDataNode v1, AbstractDataNode v2) { Type t = type(v1, v2); DSHandle r; try { if (t == Types.STRING) { r = NodeFactory.newRoot( Field.GENERIC_STRING, StringCache.intern( (String.valueOf(v1.getValue()) + String.valueOf(v2.getValue())))); } else if (t == Types.INT) { r = NodeFactory.newRoot(Field.GENERIC_INT, getInt(this, v1) + getInt(this, v2)); } else { r = NodeFactory.newRoot(Field.GENERIC_FLOAT, getFloat(this, v1) + getFloat(this, v2)); } logBinaryProvenance("sum", v1, v2, r); return r; } catch (DependentException e) { return NodeFactory.newRoot(Field.Factory.getImmutableField("?", t), e); } }