Committed by
Gerrit Code Review
Harmonize resource collectors.
Change-Id: I51fdf9cdf57d3146bd9401ff67e13063830519e4
Showing
3 changed files
with
3 additions
and
12 deletions
... | @@ -45,9 +45,7 @@ import org.slf4j.LoggerFactory; | ... | @@ -45,9 +45,7 @@ import org.slf4j.LoggerFactory; |
45 | import java.util.Collections; | 45 | import java.util.Collections; |
46 | import java.util.List; | 46 | import java.util.List; |
47 | import java.util.SortedSet; | 47 | import java.util.SortedSet; |
48 | -import java.util.TreeSet; | ||
49 | import java.util.concurrent.ExecutorService; | 48 | import java.util.concurrent.ExecutorService; |
50 | -import java.util.function.Supplier; | ||
51 | import java.util.stream.Collectors; | 49 | import java.util.stream.Collectors; |
52 | import java.util.stream.IntStream; | 50 | import java.util.stream.IntStream; |
53 | 51 | ||
... | @@ -206,10 +204,9 @@ final class ResourceDeviceListener implements DeviceListener { | ... | @@ -206,10 +204,9 @@ final class ResourceDeviceListener implements DeviceListener { |
206 | } | 204 | } |
207 | LambdaQuery query = handler.behaviour(LambdaQuery.class); | 205 | LambdaQuery query = handler.behaviour(LambdaQuery.class); |
208 | if (query != null) { | 206 | if (query != null) { |
209 | - Supplier<SortedSet<OchSignal>> supplier = () -> new TreeSet<>(new DefaultOchSignalComparator()); | ||
210 | return query.queryLambdas(port).stream() | 207 | return query.queryLambdas(port).stream() |
211 | .flatMap(x -> OchSignal.toFlexGrid(x).stream()) | 208 | .flatMap(x -> OchSignal.toFlexGrid(x).stream()) |
212 | - .collect(Collectors.toCollection(supplier)); | 209 | + .collect(Collectors.toCollection(DefaultOchSignalComparator::newOchSignalTreeSet)); |
213 | } else { | 210 | } else { |
214 | return Collections.emptySortedSet(); | 211 | return Collections.emptySortedSet(); |
215 | } | 212 | } | ... | ... |
... | @@ -49,9 +49,7 @@ import java.util.ArrayList; | ... | @@ -49,9 +49,7 @@ import java.util.ArrayList; |
49 | import java.util.List; | 49 | import java.util.List; |
50 | import java.util.Set; | 50 | import java.util.Set; |
51 | import java.util.SortedSet; | 51 | import java.util.SortedSet; |
52 | -import java.util.TreeSet; | ||
53 | import java.util.concurrent.atomic.AtomicBoolean; | 52 | import java.util.concurrent.atomic.AtomicBoolean; |
54 | -import java.util.function.Supplier; | ||
55 | import java.util.stream.Collectors; | 53 | import java.util.stream.Collectors; |
56 | import java.util.stream.IntStream; | 54 | import java.util.stream.IntStream; |
57 | 55 | ||
... | @@ -209,12 +207,11 @@ public class CalientFiberSwitchHandshaker | ... | @@ -209,12 +207,11 @@ public class CalientFiberSwitchHandshaker |
209 | ChannelSpacing.CHL_12P5GHZ.frequency().asHz(); | 207 | ChannelSpacing.CHL_12P5GHZ.frequency().asHz(); |
210 | long stopSpacingMultiplier = Spectrum.O_BAND_MAX.subtract(Spectrum.CENTER_FREQUENCY).asHz() / | 208 | long stopSpacingMultiplier = Spectrum.O_BAND_MAX.subtract(Spectrum.CENTER_FREQUENCY).asHz() / |
211 | ChannelSpacing.CHL_12P5GHZ.frequency().asHz(); | 209 | ChannelSpacing.CHL_12P5GHZ.frequency().asHz(); |
212 | - Supplier<SortedSet<OchSignal>> supplier = () -> new TreeSet<>(new DefaultOchSignalComparator()); | ||
213 | 210 | ||
214 | // Only consider odd values for the multiplier (for easy mapping to fixed grid) | 211 | // Only consider odd values for the multiplier (for easy mapping to fixed grid) |
215 | return IntStream.rangeClosed((int) startSpacingMultiplier, (int) stopSpacingMultiplier) | 212 | return IntStream.rangeClosed((int) startSpacingMultiplier, (int) stopSpacingMultiplier) |
216 | .filter(i -> i % 2 == 1) | 213 | .filter(i -> i % 2 == 1) |
217 | .mapToObj(i -> new OchSignal(GridType.FLEX, ChannelSpacing.CHL_6P25GHZ, i, 1)) | 214 | .mapToObj(i -> new OchSignal(GridType.FLEX, ChannelSpacing.CHL_6P25GHZ, i, 1)) |
218 | - .collect(Collectors.toCollection(supplier)); | 215 | + .collect(Collectors.toCollection(DefaultOchSignalComparator::newOchSignalTreeSet)); |
219 | } | 216 | } |
220 | } | 217 | } | ... | ... |
... | @@ -57,9 +57,7 @@ import java.util.LinkedList; | ... | @@ -57,9 +57,7 @@ import java.util.LinkedList; |
57 | import java.util.List; | 57 | import java.util.List; |
58 | import java.util.Set; | 58 | import java.util.Set; |
59 | import java.util.SortedSet; | 59 | import java.util.SortedSet; |
60 | -import java.util.TreeSet; | ||
61 | import java.util.concurrent.atomic.AtomicBoolean; | 60 | import java.util.concurrent.atomic.AtomicBoolean; |
62 | -import java.util.function.Supplier; | ||
63 | import java.util.stream.Collectors; | 61 | import java.util.stream.Collectors; |
64 | import java.util.stream.IntStream; | 62 | import java.util.stream.IntStream; |
65 | 63 | ||
... | @@ -373,9 +371,8 @@ public class OfOpticalSwitchImplLinc13 | ... | @@ -373,9 +371,8 @@ public class OfOpticalSwitchImplLinc13 |
373 | } | 371 | } |
374 | 372 | ||
375 | // OMS ports expose 80 fixed grid lambdas of 50GHz width, centered around the ITU-T center frequency 193.1 THz. | 373 | // OMS ports expose 80 fixed grid lambdas of 50GHz width, centered around the ITU-T center frequency 193.1 THz. |
376 | - Supplier<SortedSet<OchSignal>> supplier = () -> new TreeSet<>(new DefaultOchSignalComparator()); | ||
377 | return IntStream.range(0, LAMBDA_COUNT) | 374 | return IntStream.range(0, LAMBDA_COUNT) |
378 | .mapToObj(x -> new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, x - (LAMBDA_COUNT / 2), 4)) | 375 | .mapToObj(x -> new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, x - (LAMBDA_COUNT / 2), 4)) |
379 | - .collect(Collectors.toCollection(supplier)); | 376 | + .collect(Collectors.toCollection(DefaultOchSignalComparator::newOchSignalTreeSet)); |
380 | } | 377 | } |
381 | } | 378 | } | ... | ... |
-
Please register or login to post a comment