use of org.onlab.util.ClosedOpenRange in project onos by opennetworkinglab.
the class EncodedResourcesSerializer method read.
@Override
public EncodedDiscreteResources read(Kryo kryo, Input input, Class<EncodedDiscreteResources> cls) {
@SuppressWarnings("unchecked") List<ClosedOpenRange> ranges = kryo.readObject(input, ArrayList.class);
DiscreteResourceCodec codec = (DiscreteResourceCodec) kryo.readClassAndObject(input);
RangeSet<Integer> rangeSet = TreeRangeSet.create();
ranges.stream().map(x -> Range.closedOpen(x.lowerBound(), x.upperBound())).forEach(rangeSet::add);
return new EncodedDiscreteResources(rangeSet, codec);
}
Aggregations