/** * Typically, levels are automatically computed from the data, but in some rare instances, the user may want to * specify the levels explicitly, e.g., when the data column does not contain all the levels desired. * * @param levels * @param isOrdered a flag indicating whether the levels actually have "less than" and "greater than" left-to-right order * meaning * @throws DDFException */ public void setLevels(List<String> levels, boolean isOrdered) throws DDFException { this.setLevels(levels, null, isOrdered); }
public void setLevels(List<String> levels) throws DDFException { this.setLevels(levels, null, false); // with default values for level codes and isOrdered }
currentColumn.getOptionalFactor().setLevels(levels, true);
@Override public void setFactorLevels(String columnName, Factor<?> factor) throws DDFException { Column c = this.getColumn(columnName); Factor<?> f = c.getOptionalFactor(); if(factor.getLevelCounts() != null) { f.setLevelCounts(factor.getLevelCounts()); } if(factor.getLevels() != null) { f.setLevels(factor.getLevels(), false); } }
List<String> levels = new ArrayList<String>(levelCounts.keySet()); factor.setLevelCounts(levelCounts); factor.setLevels(levels, false);