Exemplo n.º 1
0
 /**
  * Convert the value as loaded from the SQL table into the expected variable value type (column
  * type may not match exactly the variable value type).
  *
  * @param variable
  * @param value
  * @return
  */
 private Value convertValue(Variable variable, Value value) {
   if (value.getValueType() != variable.getValueType()) {
     return variable.isRepeatable()
         ? convertToSequence(variable, value)
         : variable.getValueType().convert(value);
   }
   if (variable.isRepeatable() && !value.isSequence()) {
     return convertToSequence(variable, value);
   }
   return value;
 }
 private void add(@NotNull Value value) {
   Assert.notNull(value, "Value cannot be null");
   if (summary.empty) summary.empty = false;
   if (value.isSequence()) {
     if (value.isNull()) {
       summary.frequencyDist.addValue(NULL_NAME);
     } else {
       //noinspection ConstantConditions
       for (Value v : value.asSequence().getValue()) {
         add(v);
       }
     }
   } else {
     summary.frequencyDist.addValue(value.isNull() ? NULL_NAME : value.toString());
   }
 }