private static Pair<Double, Double> toRange(String name, ModelElement element, double defaultValue, ToDoubleFunction<String> valueParser) {
        String s = element.stringAttribute(name);
        try {
            Pair<Double, Double> pair;
            if (s == null) return new Pair<>(defaultValue, defaultValue);
            s = s.trim();
            if (s.startsWith("[") && s.endsWith("]")) {
                String[] numbers = s.substring(1, s.length() - 1).split(",");
                if (numbers.length != 2) throw new IllegalArgumentException();
                pair = new Pair<>(valueParser.applyAsDouble(numbers[0].trim()), valueParser.applyAsDouble(numbers[1].trim()));
                if (pair.getFirst() > pair.getSecond())
                    throw new IllegalArgumentException("first value cannot be larger than second value");
            } else {
                pair = new Pair<>(valueParser.applyAsDouble(s), valueParser.applyAsDouble(s));
            }
            if (pair.getFirst() < 0 || pair.getSecond() < 0)
                throw new IllegalArgumentException("values cannot be negative");
            return pair;
        }
        catch (IllegalArgumentException e) {
            throw new IllegalArgumentException("Expected a number or range on the form [min, max] for node resource '" + name + "', but got '" + s + "'", e);
        }
    }
Parses a value ("value") or value range ("[min-value, max-value]")
config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java