本文整理汇总了Java中org.onlab.util.GuavaCollectors类的典型用法代码示例。如果您正苦于以下问题:Java GuavaCollectors类的具体用法?Java GuavaCollectors怎么用?Java GuavaCollectors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuavaCollectors类属于org.onlab.util包,在下文中一共展示了GuavaCollectors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: release
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
ContinuousResourceAllocation release(ContinuousResource resource, ResourceConsumerId consumerId) {
List<ResourceAllocation> nonMatched = allocations.stream()
.filter(x -> !(x.consumerId().equals(consumerId) &&
((ContinuousResource) x.resource()).value() == resource.value()))
.collect(Collectors.toList());
List<ResourceAllocation> matched = allocations.stream()
.filter(x -> (x.consumerId().equals(consumerId) &&
((ContinuousResource) x.resource()).value() == resource.value()))
.collect(Collectors.toList());
if (matched.size() > 1) {
matched.remove(0);
}
return new ContinuousResourceAllocation(original,
Stream.concat(nonMatched.stream(), matched.stream())
.collect(GuavaCollectors.toImmutableList()));
}
示例2: queryLambdas
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
DeviceService deviceService = opticalView(this.handler().get(DeviceService.class));
Port p = deviceService.getPort(this.data().deviceId(), port);
// Only OMS ports expose lambda resources
if (p == null || !p.type().equals(Port.Type.OMS)) {
return Collections.emptySet();
}
short lambdaCount = ((OmsPort) p).totalChannels();
// OMS ports expose 'lambdaCount' fixed grid lambdas of 50GHz width, starting from min-frequency 191.7 THz.
return IntStream.rangeClosed(1, lambdaCount)
.mapToObj(x -> OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, x))
.collect(GuavaCollectors.toImmutableSet());
}
示例3: getResourceAllocations
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public <T> Collection<ResourceAllocation> getResourceAllocations(DiscreteResourceId parent, Class<T> cls) {
checkPermission(RESOURCE_READ);
checkNotNull(parent);
checkNotNull(cls);
// We access store twice in this method, then the store may be updated by others
Collection<Resource> resources = store.getAllocatedResources(parent, cls);
return resources.stream()
.flatMap(resource -> store.getResourceAllocations(resource.id()).stream())
.collect(GuavaCollectors.toImmutableList());
}
示例4: getResourceAllocations
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
List<ResourceAllocation> getResourceAllocations(ContinuousResourceId resource) {
Versioned<ContinuousResourceAllocation> allocations = consumers.get(resource);
if (allocations == null) {
return ImmutableList.of();
}
return allocations.value().allocations().stream()
.filter(x -> x.resource().id().equals(resource))
.collect(GuavaCollectors.toImmutableList());
}
示例5: queryLambdas
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
// S160 data sheet
// Wavelength range: 1260 - 1630 nm
long startSpacingMultiplier = Spectrum.U_BAND_MIN.subtract(Spectrum.CENTER_FREQUENCY).asHz() /
ChannelSpacing.CHL_12P5GHZ.frequency().asHz();
long stopSpacingMultiplier = Spectrum.O_BAND_MIN.subtract(Spectrum.CENTER_FREQUENCY).asHz() /
ChannelSpacing.CHL_12P5GHZ.frequency().asHz();
// Only consider odd values for the multiplier (for easy mapping to fixed grid)
return IntStream.rangeClosed((int) startSpacingMultiplier, (int) stopSpacingMultiplier)
.filter(i -> i % 2 == 1)
.mapToObj(i -> new OchSignal(GridType.FLEX, ChannelSpacing.CHL_6P25GHZ, i, 1))
.collect(GuavaCollectors.toImmutableSet());
}
示例6: queryLambdas
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
// Wavelength range: 1260 - 1675 nm
long startSpacingMultiplier = Spectrum.U_BAND_MIN.subtract(Spectrum.CENTER_FREQUENCY).asHz() /
ChannelSpacing.CHL_6P25GHZ.frequency().asHz();
long stopSpacingMultiplier = Spectrum.O_BAND_MAX.subtract(Spectrum.CENTER_FREQUENCY).asHz() /
ChannelSpacing.CHL_6P25GHZ.frequency().asHz();
// Only consider odd values for the multiplier (for easy mapping to fixed grid)
return IntStream.rangeClosed((int) startSpacingMultiplier, (int) stopSpacingMultiplier)
.mapToObj(x -> new OchSignal(GridType.FLEX, ChannelSpacing.CHL_6P25GHZ, x, 1))
.collect(GuavaCollectors.toImmutableSet());
}
示例7: queryLambdas
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
int startMultiplier = (int) (LumentumSnmpDevice.START_CENTER_FREQ.subtract(Spectrum.CENTER_FREQUENCY).asHz()
/ Frequency.ofGHz(50).asHz());
return IntStream.range(0, LAMBDA_COUNT)
.mapToObj(x -> new OchSignal(LumentumSnmpDevice.GRID_TYPE,
LumentumSnmpDevice.CHANNEL_SPACING,
startMultiplier + x,
4))
.collect(GuavaCollectors.toImmutableSet());
}
示例8: getEntireMplsLabels
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
private static Set<MplsLabel> getEntireMplsLabels() {
return IntStream.range(MIN_UNRESERVED_LABEL, MAX_UNRESERVED_LABEL + 1)
.mapToObj(MplsLabel::mplsLabel)
.collect(GuavaCollectors.toImmutableSet());
}
示例9: getEntireVlans
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
private static Set<VlanId> getEntireVlans() {
return IntStream.range(0, MAX_VLAN_ID)
.filter(x -> !EXCLUDED.contains(x))
.mapToObj(x -> VlanId.vlanId((short) x))
.collect(GuavaCollectors.toImmutableSet());
}
示例10: getEntireOdu2TributarySlots
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
private static Set<TributarySlot> getEntireOdu2TributarySlots() {
return IntStream.rangeClosed(1, TOTAL_ODU2_TRIBUTARY_SLOTS)
.mapToObj(TributarySlot::of)
.collect(GuavaCollectors.toImmutableSet());
}
示例11: getEntireOdu4TributarySlots
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
private static Set<TributarySlot> getEntireOdu4TributarySlots() {
return IntStream.rangeClosed(1, TOTAL_ODU4_TRIBUTARY_SLOTS)
.mapToObj(TributarySlot::of)
.collect(GuavaCollectors.toImmutableSet());
}
示例12: queryLambdas
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
return IntStream.rangeClosed(MIN_CHANNEL, MAX_CHANNEL)
.mapToObj(x -> OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, x))
.collect(GuavaCollectors.toImmutableSet());
}
示例13: queryLambdas
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
return IntStream.rangeClosed((int) startSpacingMultiplier, (int) stopSpacingMultiplier)
.mapToObj(x -> new OchSignal(GridType.FLEX, ChannelSpacing.CHL_6P25GHZ, x, 1))
.collect(GuavaCollectors.toImmutableSet());
}
示例14: queryLambdas
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
@Override
public Set<OchSignal> queryLambdas(PortNumber port) {
return IntStream.rangeClosed(MIN_CHANNEL, MAX_CHANNEL)
.mapToObj(x -> OchSignal.newDwdmSlot(CHANNEL_SPACING, x))
.collect(GuavaCollectors.toImmutableSet());
}
示例15: getRoutes
import org.onlab.util.GuavaCollectors; //导入依赖的package包/类
/**
* Returns all routes in the route table.
*
* @return all routes
*/
public Collection<ResolvedRoute> getRoutes() {
return Tools.stream(routeTable.getKeyValuePairsForKeysStartingWith(""))
.map(KeyValuePair::getValue)
.collect(GuavaCollectors.toImmutableList());
}