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