Add UnsignedLongRangeSet.toString() 47/90447/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 15 Jun 2020 09:17:31 +0000 (11:17 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 15 Jun 2020 09:17:31 +0000 (11:17 +0200)
This makes the rangeset a wee bit more useful for debugging purposes.

Change-Id: Ie7a38fa980463be5255201996cd7b06ab50bde2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/UnsignedLongRangeSet.java

index a1499c5..b8c2fcc 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.cluster.datastore.utils;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
 import com.google.common.collect.ImmutableRangeSet;
 import com.google.common.collect.Range;
 import com.google.common.collect.RangeSet;
@@ -64,4 +65,12 @@ public final class UnsignedLongRangeSet implements Mutable {
     public UnsignedLongRangeSet copy() {
         return new UnsignedLongRangeSet(TreeRangeSet.create(rangeset));
     }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+                .add("span", rangeset.span())
+                .add("rangeSize", rangeset.asRanges().size())
+                .toString();
+    }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.