当前位置: 首页>>代码示例>>Java>>正文


Java GuavaCollectors类代码示例

本文整理汇总了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()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:ContinuousResourceAllocation.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:OFOpticalSwitch13LambdaQuery.java

示例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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:ResourceManager.java

示例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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:ConsistentContinuousResourceSubStore.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:16,代码来源:CalientLambdaQuery.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:14,代码来源:OplinkSwitchLambdaQuery.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:13,代码来源:LumentumSdnRoadmLambdaQuery.java

示例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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:FullMplsAvailable.java

示例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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:FullVlanAvailable.java

示例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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:DefaultTributarySlotQuery.java

示例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());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:DefaultTributarySlotQuery.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:7,代码来源:OplinkRoadmLambdaQuery.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:7,代码来源:OplinkEdfaLambdaQuery.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:7,代码来源:OplinkOpticalLambdaQuery.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:11,代码来源:DefaultResolvedRouteStore.java


注:本文中的org.onlab.util.GuavaCollectors类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。