public static FeatureRange buildFromMixedIn(String key, List<String> partitions, int arity) {
        Long fromInclusive = null;
        Long toInclusive = null;
        long from = 0;
        long to = 0;
        for (String p : partitions) {
            String[] parts = p.split(",");
            if (parts.length == 1) {
                String[] subparts = parts[0].split("=|-");
                int offset = subparts.length == 3? 0 : 1;
                if (subparts.length < 3 || subparts.length > 4) {
                    throw new IllegalArgumentException("MIXED_IN range partition must be on the form label=val-val");
                }
                from = Long.parseLong(subparts[offset + 1]);
                to = Long.parseLong(subparts[offset + 2]);
                if (parts[0].contains("=-")) {
                    long tmp = from;
                    from = -to;
                    to = -tmp;
                }
            } else {
                if (parts.length != 3) {
                    throw new IllegalArgumentException("MIXED_IN range edge partition must be on the form label=val,val,payload");
                }
                long value = Long.parseLong(parts[1]);
                long payload = Long.parseLong(parts[2]);
                if ((payload & 0xc0000000) == 0x80000000L) {
                    from = value + (payload & 0xffff);
                    to = value + arity - 1;
                } else if ((payload & 0xc0000000) == 0x40000000L) {
                    from = value;
                    to = value + (payload & 0xffff);
                } else {
                    from = value + (payload >> 16);
                    to = value + (payload & 0xffff);
                }
            }
            if (fromInclusive == null || fromInclusive > from) {
                fromInclusive = from;
            }
            if (toInclusive == null || toInclusive > to) {
                toInclusive = to;
            }
        }
        return new FeatureRange(key, fromInclusive, toInclusive);
    }
@Test
    void requireThatFeatureRangeCanBeBuiltFromMixedInNode() {
        assertEquals(new FeatureRange("foo", 10L, 19L),
                FeatureRange.buildFromMixedIn("foo", List.of("foo=10-19"), 10));
        assertEquals(new FeatureRange("foo", -19L, -10L),
                FeatureRange.buildFromMixedIn("foo", List.of("foo=-10-19"), 10));
        assertEquals(new FeatureRange("foo", 10L, 19L),
                FeatureRange.buildFromMixedIn("foo", List.of("foo=10,10,9"), 10));
        assertEquals(new FeatureRange("foo", 10L, 19L),
                FeatureRange.buildFromMixedIn("foo", List.of("foo=10,10,1073741833"), 10));
        assertEquals(new FeatureRange("foo", 10L, 19L),
                FeatureRange.buildFromMixedIn("foo", List.of("foo=10,10,2147483648"), 10));
    }