public Numerical1DDataDomainValues(TablePerspective data, EDimension main) { super(data, main); Perspective p = main.select(data.getDimensionPerspective(), data.getRecordPerspective()); this.groups = Numerical1DMixin.extractGroups(p, this); this.isInteger = DataSupportDefinitions.dataClass(EDataClass.NATURAL_NUMBER).apply(data); Object desc = getDescription(); Float min = null, max = null; if (desc instanceof NumericalProperties) { min = ((NumericalProperties) desc).getMin(); max = ((NumericalProperties) desc).getMax(); } if (min == null || min.isNaN() || max == null || max.isNaN()) { DoubleStatistics stats = createStats(this, groups); if (min == null || min.isNaN()) min = (float) stats.getMin(); if (max == null || max.isNaN()) max = (float) stats.getMax(); } this.mixin = new Numerical1DMixin(this, groups, min.floatValue(), max.floatValue()); }
private static DoubleStatistics createStats(INumerical1DContainer c, TypedGroupSet groups) { DoubleStatistics.Builder b = DoubleStatistics.builder(); for (Integer id : groups) b.add(c.getRaw(id)); return b.build(); }