2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.utils;
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.Collections2;
12 import com.google.common.collect.ImmutableRangeSet;
13 import com.google.common.primitives.UnsignedLong;
14 import java.util.TreeSet;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.opendaylight.yangtools.concepts.Mutable;
19 public final class MutableUnsignedLongSet extends UnsignedLongSet implements Mutable {
20 MutableUnsignedLongSet(final TreeSet<Entry> ranges) {
24 public static @NonNull MutableUnsignedLongSet of() {
25 return new MutableUnsignedLongSet(new TreeSet<>());
29 public ImmutableUnsignedLongSet immutableCopy() {
30 return ImmutableUnsignedLongSet.of(copyRanges());
33 public void add(final long longBits) {
37 public ImmutableRangeSet<UnsignedLong> toRangeSet() {
38 return ImmutableRangeSet.copyOf(Collections2.transform(trustedRanges(), Entry::toUnsigned));