update and get available link resource consindering existing linkAllocations

Change-Id: Iee93253d253ff38d23630a2c5ac9c0a14329d92f
This commit is contained in:
weibit 2014-11-16 07:09:05 -08:00 committed by Ray Milkey
parent 112c703dc5
commit 00c94f5533
3 changed files with 10 additions and 7 deletions

View File

@ -86,7 +86,7 @@ public interface LinkResourceService {
* @param allocations allocations to be included as available
* @return available resources for the target link
*/
ResourceRequest getAvailableResources(Link link,
Iterable<ResourceRequest> getAvailableResources(Link link,
LinkResourceAllocations allocations);
}

View File

@ -269,7 +269,7 @@ public class IntentTestsMocks {
}
@Override
public ResourceRequest getAvailableResources(Link link, LinkResourceAllocations allocations) {
public Iterable<ResourceRequest> getAvailableResources(Link link, LinkResourceAllocations allocations) {
return null;
}
}

View File

@ -156,8 +156,8 @@ public class LinkResourceManager implements LinkResourceService {
@Override
public LinkResourceAllocations updateResources(LinkResourceRequest req,
LinkResourceAllocations oldAllocations) {
// TODO
return null;
releaseResources(oldAllocations);
return requestResources(req);
}
@Override
@ -196,10 +196,13 @@ public class LinkResourceManager implements LinkResourceService {
}
@Override
public ResourceRequest getAvailableResources(Link link,
public Iterable<ResourceRequest> getAvailableResources(Link link,
LinkResourceAllocations allocations) {
// TODO
return null;
Set<ResourceRequest> result = new HashSet<>();
Set<ResourceAllocation> allocatedRes = allocations.getResourceAllocation(link);
result = (Set<ResourceRequest>) getAvailableResources(link);
result.addAll(allocatedRes);
return result;
}
}