Beispiel #1
0
 /** Returns the concatenation of the two values. */
 @Override
 public Value concatenate(Value v) {
   if (v instanceof StringVal) {
     return ValueFactory.create(str + " " + v.toString());
   } else if (v instanceof DoubleVal) {
     return ValueFactory.create(str + " " + v.toString());
   } else if (v instanceof NoneVal) {
     return this;
   } else {
     log.warning("cannot concatenate " + this + " and " + v);
     return ValueFactory.noneValue;
   }
 }
Beispiel #2
0
 /** Returns a list of words */
 @Override
 public Collection<Value> getSubValues() {
   return Arrays.stream(str.split(" "))
       .map(w -> ValueFactory.create(w))
       .collect(Collectors.toList());
 }