Exemplo n.º 1
0
 @Override
 protected DSHandle value(AbstractDataNode v1, AbstractDataNode v2) {
   DSHandle r =
       NodeFactory.newRoot(Field.GENERIC_BOOLEAN, getBool(this, v1) || getBool(this, v2));
   logBinaryProvenance("or", v1, v2, r);
   return r;
 }
Exemplo n.º 2
0
 @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);
   }
 }
Exemplo n.º 3
0
 @Override
 protected DSHandle value(AbstractDataNode v1, AbstractDataNode v2) {
   DSHandle r =
       NodeFactory.newRoot(Field.GENERIC_FLOAT, getFloat(this, v1) / getFloat(this, v2));
   logBinaryProvenance("fquotient", v1, v2, r);
   return r;
 }
Exemplo n.º 4
0
 @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);
   }
 }
Exemplo n.º 5
0
 @Override
 protected DSHandle value(AbstractDataNode v) {
   DSHandle r = NodeFactory.newRoot(Field.GENERIC_INT, getInt(this, v) + 1);
   return r;
 }
Exemplo n.º 6
0
 @Override
 protected DSHandle value(AbstractDataNode v) {
   DSHandle r = NodeFactory.newRoot(Field.GENERIC_BOOLEAN, !getBool(this, v));
   logUnaryProvenance("not", v, r);
   return r;
 }
Exemplo n.º 7
0
 @Override
 protected DSHandle value(AbstractDataNode v1, AbstractDataNode v2) {
   DSHandle r = NodeFactory.newRoot(Field.GENERIC_BOOLEAN, !v1.getValue().equals(v2.getValue()));
   logBinaryProvenance("ne", v1, v2, r);
   return r;
 }