commit | 9e3031a061fb59b1442b6d33e9513f228865600a | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Tue Jun 07 16:32:06 2016 -0700 |
committer | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Tue Jun 14 14:30:35 2016 -0700 |
tree | c275d940bb3954c5703c05637cb9221e85e69536 | |
parent | ecb7898803df55bfa080ed23b720ecd9a333c455 [diff] [blame] |
Add short-cut path taking when the paremter type is equal to own type Change-Id: Ifbc3ea11c901b1496adcc8d0a372c86cd27969e2
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java index b229308..4862606 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java +++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java
@@ -93,6 +93,15 @@ @Override public DiscreteResources add(DiscreteResources other) { + if (other instanceof UnifiedDiscreteResources) { + UnifiedDiscreteResources cast = (UnifiedDiscreteResources) other; + return new UnifiedDiscreteResources( + this.generics.add(cast.generics), + this.encodables.add(cast.encodables)); + } else if (other instanceof EmptyDiscreteResources) { + return this; + } + return of(Sets.union(this.values(), other.values())); }