Search in sources :

Example 1 with OptionBound

use of pcgen.cdom.helper.OptionBound in project pcgen by PCGen.

the class OptionToken method unparse.

@Override
public String[] unparse(LoadContext context, BaseKit kit) {
    Collection<OptionBound> bounds = kit.getBounds();
    if (bounds == null) {
        return null;
    }
    List<String> list = new ArrayList<>();
    for (OptionBound bound : bounds) {
        Formula min = bound.getOptionMin();
        Formula max = bound.getOptionMax();
        if (min == null || max == null) {
            // Error if only one is null
            return null;
        }
        StringBuilder sb = new StringBuilder();
        sb.append(min);
        if (!min.equals(max)) {
            sb.append(',').append(max);
        }
        list.add(sb.toString());
    }
    return new String[] { StringUtil.join(list, Constants.PIPE) };
}
Also used : Formula(pcgen.base.formula.Formula) OptionBound(pcgen.cdom.helper.OptionBound) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 Formula (pcgen.base.formula.Formula)1 OptionBound (pcgen.cdom.helper.OptionBound)1