Committed by
Gerrit Code Review
Rename: use plural according to the returned type
Change-Id: I7db9ae2fda2f7240d69ad7dbd028ccc0ea8a8fd8
Showing
5 changed files
with
10 additions
and
10 deletions
| ... | @@ -133,7 +133,7 @@ public interface ResourceService extends ListenerService<ResourceEvent, Resource | ... | @@ -133,7 +133,7 @@ public interface ResourceService extends ListenerService<ResourceEvent, Resource |
| 133 | * If the resource is not allocated, the return value is an empty list. | 133 | * If the resource is not allocated, the return value is an empty list. |
| 134 | */ | 134 | */ |
| 135 | // TODO: need to change the argument type to ResourceId | 135 | // TODO: need to change the argument type to ResourceId |
| 136 | - List<ResourceAllocation> getResourceAllocation(Resource resource); | 136 | + List<ResourceAllocation> getResourceAllocations(Resource resource); |
| 137 | 137 | ||
| 138 | /** | 138 | /** |
| 139 | * Returns allocated resources being as children of the specified parent and being the specified resource type. | 139 | * Returns allocated resources being as children of the specified parent and being the specified resource type. | ... | ... |
| ... | @@ -312,7 +312,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -312,7 +312,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
| 312 | if (ochCP != null) { | 312 | if (ochCP != null) { |
| 313 | OchPort ochPort = (OchPort) deviceService.getPort(ochCP.deviceId(), ochCP.port()); | 313 | OchPort ochPort = (OchPort) deviceService.getPort(ochCP.deviceId(), ochCP.port()); |
| 314 | Optional<IntentId> intentId = | 314 | Optional<IntentId> intentId = |
| 315 | - resourceService.getResourceAllocation(Resource.discrete(ochCP.deviceId(), ochCP.port())) | 315 | + resourceService.getResourceAllocations(Resource.discrete(ochCP.deviceId(), ochCP.port())) |
| 316 | .stream() | 316 | .stream() |
| 317 | .map(ResourceAllocation::consumer) | 317 | .map(ResourceAllocation::consumer) |
| 318 | .filter(x -> x instanceof IntentId) | 318 | .filter(x -> x instanceof IntentId) |
| ... | @@ -333,7 +333,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -333,7 +333,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | Optional<IntentId> intentId = | 335 | Optional<IntentId> intentId = |
| 336 | - resourceService.getResourceAllocation(Resource.discrete(oduPort.deviceId(), port.number())) | 336 | + resourceService.getResourceAllocations(Resource.discrete(oduPort.deviceId(), port.number())) |
| 337 | .stream() | 337 | .stream() |
| 338 | .map(ResourceAllocation::consumer) | 338 | .map(ResourceAllocation::consumer) |
| 339 | .filter(x -> x instanceof IntentId) | 339 | .filter(x -> x instanceof IntentId) | ... | ... |
| ... | @@ -114,7 +114,7 @@ public final class ResourceManager extends AbstractListenerManager<ResourceEvent | ... | @@ -114,7 +114,7 @@ public final class ResourceManager extends AbstractListenerManager<ResourceEvent |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | @Override | 116 | @Override |
| 117 | - public List<ResourceAllocation> getResourceAllocation(Resource resource) { | 117 | + public List<ResourceAllocation> getResourceAllocations(Resource resource) { |
| 118 | checkNotNull(resource); | 118 | checkNotNull(resource); |
| 119 | 119 | ||
| 120 | List<ResourceConsumer> consumers = store.getConsumers(resource); | 120 | List<ResourceConsumer> consumers = store.getConsumers(resource); | ... | ... |
| ... | @@ -68,7 +68,7 @@ class MockResourceService implements ResourceService { | ... | @@ -68,7 +68,7 @@ class MockResourceService implements ResourceService { |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | @Override | 70 | @Override |
| 71 | - public List<ResourceAllocation> getResourceAllocation(Resource resource) { | 71 | + public List<ResourceAllocation> getResourceAllocations(Resource resource) { |
| 72 | return Optional.ofNullable(assignment.get(resource)) | 72 | return Optional.ofNullable(assignment.get(resource)) |
| 73 | .map(x -> ImmutableList.of(new ResourceAllocation(resource, x))) | 73 | .map(x -> ImmutableList.of(new ResourceAllocation(resource, x))) |
| 74 | .orElse(ImmutableList.of()); | 74 | .orElse(ImmutableList.of()); | ... | ... |
| ... | @@ -115,13 +115,13 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour | ... | @@ -115,13 +115,13 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour |
| 115 | checkArgument(resource instanceof DiscreteResource || resource instanceof ContinuousResource); | 115 | checkArgument(resource instanceof DiscreteResource || resource instanceof ContinuousResource); |
| 116 | 116 | ||
| 117 | if (resource instanceof DiscreteResource) { | 117 | if (resource instanceof DiscreteResource) { |
| 118 | - return getConsumer((DiscreteResource) resource); | 118 | + return getConsumers((DiscreteResource) resource); |
| 119 | } else { | 119 | } else { |
| 120 | - return getConsumer((ContinuousResource) resource); | 120 | + return getConsumers((ContinuousResource) resource); |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | - private List<ResourceConsumer> getConsumer(DiscreteResource resource) { | 124 | + private List<ResourceConsumer> getConsumers(DiscreteResource resource) { |
| 125 | Versioned<ResourceConsumer> consumer = discreteConsumers.get(resource); | 125 | Versioned<ResourceConsumer> consumer = discreteConsumers.get(resource); |
| 126 | if (consumer == null) { | 126 | if (consumer == null) { |
| 127 | return ImmutableList.of(); | 127 | return ImmutableList.of(); |
| ... | @@ -130,7 +130,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour | ... | @@ -130,7 +130,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour |
| 130 | return ImmutableList.of(consumer.value()); | 130 | return ImmutableList.of(consumer.value()); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | - private List<ResourceConsumer> getConsumer(ContinuousResource resource) { | 133 | + private List<ResourceConsumer> getConsumers(ContinuousResource resource) { |
| 134 | Versioned<ContinuousResourceAllocation> allocations = continuousConsumers.get(resource.id()); | 134 | Versioned<ContinuousResourceAllocation> allocations = continuousConsumers.get(resource.id()); |
| 135 | if (allocations == null) { | 135 | if (allocations == null) { |
| 136 | return ImmutableList.of(); | 136 | return ImmutableList.of(); |
| ... | @@ -337,7 +337,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour | ... | @@ -337,7 +337,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour |
| 337 | 337 | ||
| 338 | if (resource instanceof DiscreteResource) { | 338 | if (resource instanceof DiscreteResource) { |
| 339 | // check if already consumed | 339 | // check if already consumed |
| 340 | - return getConsumer((DiscreteResource) resource).isEmpty(); | 340 | + return getConsumers((DiscreteResource) resource).isEmpty(); |
| 341 | } else { | 341 | } else { |
| 342 | ContinuousResource requested = (ContinuousResource) resource; | 342 | ContinuousResource requested = (ContinuousResource) resource; |
| 343 | ContinuousResource registered = v.value().stream() | 343 | ContinuousResource registered = v.value().stream() | ... | ... |
-
Please register or login to post a comment