private void add(@NotNull ValueTable table, @NotNull ValueSource variableValueSource) {
      Assert.notNull(table, "ValueTable cannot be null");
      Assert.notNull(variableValueSource, "variableValueSource cannot be null");

      VectorSource vectorSource = variableValueSource.asVectorSource();
      if (vectorSource == null) return;
      for (Value value : vectorSource.getValues(summary.getVariableEntities(table))) {
        add(value);
      }
    }
    private void compute() {
      long max = 0;
      Iterator<String> concat =
          summary.distinct //
              ? freqNames(summary.frequencyDist) // category names, null values and distinct values
              : Iterators.concat(
                  categoryNames(),
                  ImmutableList.of(NULL_NAME).iterator()); // category names and null values

      // Iterate over all category names including or not distinct values.
      // The loop will also determine the mode of the distribution (most frequent value)
      while (concat.hasNext()) {
        String value = concat.next();
        long count = summary.frequencyDist.getCount(value);
        if (count > max) {
          max = count;
          summary.mode = value;
        }
        summary.frequencies.add(
            new Frequency(
                value, summary.frequencyDist.getCount(value), summary.frequencyDist.getPct(value)));
      }
      summary.n = summary.frequencyDist.getSumFreq();
    }
 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());
   }
 }
 public Builder filter(Integer offset, Integer limit) {
   summary.setOffset(offset);
   summary.setLimit(limit);
   return this;
 }
 public Builder distinct(boolean distinct) {
   summary.setDistinct(distinct);
   return this;
 }