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 * @param allocations allocations to be included as available
* @return available resources for the target link * @return available resources for the target link
*/ */
ResourceRequest getAvailableResources(Link link, Iterable<ResourceRequest> getAvailableResources(Link link,
LinkResourceAllocations allocations); LinkResourceAllocations allocations);
} }

View File

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

View File

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