Sho SHIMIZU
Committed by Gerrit Code Review

Rename: use plural according to the returned type

Change-Id: I7db9ae2fda2f7240d69ad7dbd028ccc0ea8a8fd8
......@@ -133,7 +133,7 @@ public interface ResourceService extends ListenerService<ResourceEvent, Resource
* If the resource is not allocated, the return value is an empty list.
*/
// TODO: need to change the argument type to ResourceId
List<ResourceAllocation> getResourceAllocation(Resource resource);
List<ResourceAllocation> getResourceAllocations(Resource resource);
/**
* 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
if (ochCP != null) {
OchPort ochPort = (OchPort) deviceService.getPort(ochCP.deviceId(), ochCP.port());
Optional<IntentId> intentId =
resourceService.getResourceAllocation(Resource.discrete(ochCP.deviceId(), ochCP.port()))
resourceService.getResourceAllocations(Resource.discrete(ochCP.deviceId(), ochCP.port()))
.stream()
.map(ResourceAllocation::consumer)
.filter(x -> x instanceof IntentId)
......@@ -333,7 +333,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
}
Optional<IntentId> intentId =
resourceService.getResourceAllocation(Resource.discrete(oduPort.deviceId(), port.number()))
resourceService.getResourceAllocations(Resource.discrete(oduPort.deviceId(), port.number()))
.stream()
.map(ResourceAllocation::consumer)
.filter(x -> x instanceof IntentId)
......
......@@ -114,7 +114,7 @@ public final class ResourceManager extends AbstractListenerManager<ResourceEvent
}
@Override
public List<ResourceAllocation> getResourceAllocation(Resource resource) {
public List<ResourceAllocation> getResourceAllocations(Resource resource) {
checkNotNull(resource);
List<ResourceConsumer> consumers = store.getConsumers(resource);
......
......@@ -68,7 +68,7 @@ class MockResourceService implements ResourceService {
}
@Override
public List<ResourceAllocation> getResourceAllocation(Resource resource) {
public List<ResourceAllocation> getResourceAllocations(Resource resource) {
return Optional.ofNullable(assignment.get(resource))
.map(x -> ImmutableList.of(new ResourceAllocation(resource, x)))
.orElse(ImmutableList.of());
......
......@@ -115,13 +115,13 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
checkArgument(resource instanceof DiscreteResource || resource instanceof ContinuousResource);
if (resource instanceof DiscreteResource) {
return getConsumer((DiscreteResource) resource);
return getConsumers((DiscreteResource) resource);
} else {
return getConsumer((ContinuousResource) resource);
return getConsumers((ContinuousResource) resource);
}
}
private List<ResourceConsumer> getConsumer(DiscreteResource resource) {
private List<ResourceConsumer> getConsumers(DiscreteResource resource) {
Versioned<ResourceConsumer> consumer = discreteConsumers.get(resource);
if (consumer == null) {
return ImmutableList.of();
......@@ -130,7 +130,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
return ImmutableList.of(consumer.value());
}
private List<ResourceConsumer> getConsumer(ContinuousResource resource) {
private List<ResourceConsumer> getConsumers(ContinuousResource resource) {
Versioned<ContinuousResourceAllocation> allocations = continuousConsumers.get(resource.id());
if (allocations == null) {
return ImmutableList.of();
......@@ -337,7 +337,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
if (resource instanceof DiscreteResource) {
// check if already consumed
return getConsumer((DiscreteResource) resource).isEmpty();
return getConsumers((DiscreteResource) resource).isEmpty();
} else {
ContinuousResource requested = (ContinuousResource) resource;
ContinuousResource registered = v.value().stream()
......