Rename NonEncodableDiscreteResources to GenericDiscreteResources
Change-Id: Ib610895b3e2251af1ae5b1cae2b9b8f378a8d920
(cherry picked from commit 18b27e2b73b8e6f9e97997e381a73051f41797f6)
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
index dd78e50..3aa07f4 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
@@ -74,7 +74,7 @@
.register(KryoNamespaces.API)
.register(UnifiedDiscreteResources.class)
.register(new EncodableDiscreteResourcesSerializer(), EncodableDiscreteResources.class)
- .register(NonEncodableDiscreteResources.class)
+ .register(GenericDiscreteResources.class)
.register(EmptyDiscreteResources.class)
.register(ContinuousResourceAllocation.class)
.build());
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/NonEncodableDiscreteResources.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/GenericDiscreteResources.java
similarity index 85%
rename from core/store/dist/src/main/java/org/onosproject/store/resource/impl/NonEncodableDiscreteResources.java
rename to core/store/dist/src/main/java/org/onosproject/store/resource/impl/GenericDiscreteResources.java
index 333a40b..161f1ff 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/NonEncodableDiscreteResources.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/GenericDiscreteResources.java
@@ -27,7 +27,7 @@
import java.util.Optional;
import java.util.Set;
-final class NonEncodableDiscreteResources implements DiscreteResources {
+final class GenericDiscreteResources implements DiscreteResources {
private final Set<DiscreteResource> values;
static DiscreteResources of(Set<DiscreteResource> resources) {
@@ -35,15 +35,15 @@
return DiscreteResources.empty();
}
- return new NonEncodableDiscreteResources(resources);
+ return new GenericDiscreteResources(resources);
}
- private NonEncodableDiscreteResources(Set<DiscreteResource> values) {
+ private GenericDiscreteResources(Set<DiscreteResource> values) {
this.values = values;
}
// for serializer
- private NonEncodableDiscreteResources() {
+ private GenericDiscreteResources() {
this.values = null;
}
@@ -59,7 +59,7 @@
@Override
public DiscreteResources difference(DiscreteResources other) {
- return new NonEncodableDiscreteResources(Sets.difference(this.values, other.values()));
+ return new GenericDiscreteResources(Sets.difference(this.values, other.values()));
}
@Override
@@ -77,7 +77,7 @@
public DiscreteResources add(DiscreteResources other) {
Set<DiscreteResource> newValues = new LinkedHashSet<>(this.values);
newValues.addAll(other.values());
- return new NonEncodableDiscreteResources(newValues);
+ return new GenericDiscreteResources(newValues);
}
// returns a new instance, not mutate the current instance
@@ -85,7 +85,7 @@
public DiscreteResources remove(List<DiscreteResource> removed) {
Set<DiscreteResource> newValues = new LinkedHashSet<>(this.values);
newValues.removeAll(removed);
- return new NonEncodableDiscreteResources(newValues);
+ return new GenericDiscreteResources(newValues);
}
@Override
@@ -108,7 +108,7 @@
if (obj == null || getClass() != obj.getClass()) {
return false;
}
- final NonEncodableDiscreteResources other = (NonEncodableDiscreteResources) obj;
+ final GenericDiscreteResources other = (GenericDiscreteResources) obj;
return Objects.equals(this.values, other.values);
}
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 1b4ded4..7b15a0a 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
@@ -33,7 +33,7 @@
* and those that can't encoded as integer.
*/
final class UnifiedDiscreteResources implements DiscreteResources {
- private final DiscreteResources nonEncodables;
+ private final DiscreteResources generics;
private final DiscreteResources encodables;
private static final Codecs CODECS = Codecs.getInstance();
@@ -45,13 +45,13 @@
Map<Boolean, Set<DiscreteResource>> partitioned = resources.stream()
.collect(Collectors.partitioningBy(CODECS::isEncodable, Collectors.toCollection(LinkedHashSet::new)));
return new UnifiedDiscreteResources(
- NonEncodableDiscreteResources.of(partitioned.get(false)),
+ GenericDiscreteResources.of(partitioned.get(false)),
EncodableDiscreteResources.of(partitioned.get(true))
);
}
- private UnifiedDiscreteResources(DiscreteResources nonEncodables, DiscreteResources encodables) {
- this.nonEncodables = nonEncodables;
+ private UnifiedDiscreteResources(DiscreteResources generics, DiscreteResources encodables) {
+ this.generics = generics;
this.encodables = encodables;
}
@@ -61,7 +61,7 @@
return encodables.lookup(id);
}
- return nonEncodables.lookup(id);
+ return generics.lookup(id);
}
@Override
@@ -71,14 +71,14 @@
@Override
public boolean isEmpty() {
- return nonEncodables.isEmpty() && encodables.isEmpty();
+ return generics.isEmpty() && encodables.isEmpty();
}
@Override
public boolean containsAny(List<DiscreteResource> other) {
Map<Boolean, List<DiscreteResource>> partitioned = other.stream()
.collect(Collectors.partitioningBy(CODECS::isEncodable));
- return nonEncodables.containsAny(partitioned.get(false)) || encodables.containsAny(partitioned.get(true));
+ return generics.containsAny(partitioned.get(false)) || encodables.containsAny(partitioned.get(true));
}
@Override
@@ -93,7 +93,7 @@
@Override
public Set<DiscreteResource> values() {
- return Stream.concat(encodables.values().stream(), nonEncodables.values().stream())
+ return Stream.concat(encodables.values().stream(), generics.values().stream())
.collect(Collectors.toCollection(LinkedHashSet::new));
}
}