commit | 31f37edd9929e606e03c784d94103dfd6601d117 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Fri Jan 08 18:45:54 2016 -0800 |
committer | Gerrit Code Review <gerrit@onlab.us> | Thu Jan 14 07:35:50 2016 +0000 |
tree | 3f19564099280aeccc78f36124bf732a977cb096 | |
parent | e9ac2c50b963465b3210f4336bbe75c8436aeb59 [diff] |
Define sub-types of Bandwidth to reduce round-off error Two sub-types are defined - LongBandwidth - DoubleBandwidth LongBandwidth can reduce round-off error cause by floating point arithmetics. These classes are not exposed outside the package and only instantiated through static factory methods. Change-Id: Ice5d8ff1397c9dd9c8c1fff46af256fff08fa616
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java index 7223d57..16a2a99 100644 --- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java +++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -267,6 +267,8 @@ .register(VlanId.class) .register(Frequency.class) .register(Bandwidth.class) + .register(Bandwidth.bps(1L).getClass()) + .register(Bandwidth.bps(1.0).getClass()) .build(); /** @@ -283,7 +285,7 @@ .register(BASIC) .nextId(KryoNamespace.INITIAL_ID + 30) .register(MISC) - .nextId(KryoNamespace.INITIAL_ID + 30 + 10) + .nextId(KryoNamespace.INITIAL_ID + 30 + 20) .register( Instructions.MeterInstruction.class, MeterId.class,
diff --git a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java index aca0acc..9ee9cd9 100644 --- a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java +++ b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
@@ -397,6 +397,7 @@ @Test public void testBandwidth() { + testSerializedEquals(Bandwidth.mbps(1000)); testSerializedEquals(Bandwidth.mbps(1000.0)); }