Committed by
Ray Milkey
Use switch statement instead of if statement
Change-Id: I0ba108cc53bbc03e086e1433dff65a356aee7886
Showing
1 changed file
with
6 additions
and
6 deletions
... | @@ -136,17 +136,17 @@ public class ConsistentLinkResourceStore extends | ... | @@ -136,17 +136,17 @@ public class ConsistentLinkResourceStore extends |
136 | } | 136 | } |
137 | 137 | ||
138 | private Set<ResourceAllocation> getResourceCapacity(ResourceType type, Link link) { | 138 | private Set<ResourceAllocation> getResourceCapacity(ResourceType type, Link link) { |
139 | - if (type == ResourceType.BANDWIDTH) { | 139 | + switch (type) { |
140 | + case BANDWIDTH: | ||
140 | return ImmutableSet.of(getBandwidthResourceCapacity(link)); | 141 | return ImmutableSet.of(getBandwidthResourceCapacity(link)); |
141 | - } | 142 | + case LAMBDA: |
142 | - if (type == ResourceType.LAMBDA) { | ||
143 | return getLambdaResourceCapacity(link); | 143 | return getLambdaResourceCapacity(link); |
144 | - } | 144 | + case MPLS_LABEL: |
145 | - if (type == ResourceType.MPLS_LABEL) { | ||
146 | return getMplsResourceCapacity(); | 145 | return getMplsResourceCapacity(); |
147 | - } | 146 | + default: |
148 | return ImmutableSet.of(); | 147 | return ImmutableSet.of(); |
149 | } | 148 | } |
149 | + } | ||
150 | 150 | ||
151 | private Set<ResourceAllocation> getLambdaResourceCapacity(Link link) { | 151 | private Set<ResourceAllocation> getLambdaResourceCapacity(Link link) { |
152 | Port port = deviceService.getPort(link.src().deviceId(), link.src().port()); | 152 | Port port = deviceService.getPort(link.src().deviceId(), link.src().port()); | ... | ... |
-
Please register or login to post a comment