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


Java ClockEntry类代码示例

本文整理汇总了Java中org.sdnplatform.sync.internal.version.ClockEntry的典型用法代码示例。如果您正苦于以下问题:Java ClockEntry类的具体用法?Java ClockEntry怎么用?Java ClockEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClockEntry类属于org.sdnplatform.sync.internal.version包,在下文中一共展示了ClockEntry类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTVectorClock

import org.sdnplatform.sync.internal.version.ClockEntry; //导入依赖的package包/类
/**
 * Convert a {@link VectorClock} into a 
 * {@link org.sdnplatform.sync.thrift.VectorClock}
 * @param vc the input clock
 * @return the output thrift object
 */
public static org.sdnplatform.sync.thrift.VectorClock
    getTVectorClock(VectorClock vc) {
    org.sdnplatform.sync.thrift.VectorClock tvc =
            new org.sdnplatform.sync.thrift.VectorClock();
    tvc.setTimestamp(vc.getTimestamp());
    for (ClockEntry ce : vc.getEntries()) {
        org.sdnplatform.sync.thrift.ClockEntry tce =
                new org.sdnplatform.sync.thrift.ClockEntry();
        tce.setNodeId(ce.getNodeId());
        tce.setVersion(ce.getVersion());
        tvc.addToVersions(tce);
    }
    
    return tvc;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:22,代码来源:TProtocolUtil.java

示例2: getTVectorClock

import org.sdnplatform.sync.internal.version.ClockEntry; //导入依赖的package包/类
/**
 * Convert a {@link VectorClock} into a
 * {@link org.sdnplatform.sync.thrift.VectorClock}
 * @param vc the input clock
 * @return the output thrift object
 */
public static org.sdnplatform.sync.thrift.VectorClock
    getTVectorClock(VectorClock vc) {
    org.sdnplatform.sync.thrift.VectorClock tvc =
            new org.sdnplatform.sync.thrift.VectorClock();
    tvc.setTimestamp(vc.getTimestamp());
    for (ClockEntry ce : vc.getEntries()) {
        org.sdnplatform.sync.thrift.ClockEntry tce =
                new org.sdnplatform.sync.thrift.ClockEntry();
        tce.setNodeId(ce.getNodeId());
        tce.setVersion(ce.getVersion());
        tvc.addToVersions(tce);
    }

    return tvc;
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:22,代码来源:TProtocolUtil.java

示例3: getVersion

import org.sdnplatform.sync.internal.version.ClockEntry; //导入依赖的package包/类
/**
 * Convert a thrift {@link org.sdnplatform.sync.thrift.VectorClock} into
 * a {@link VectorClock}.
 * @param tvc the {@link org.sdnplatform.sync.thrift.VectorClock}
 * @param the {@link VectorClock}
 */
public static VectorClock getVersion(org.sdnplatform.sync.thrift.VectorClock tvc) {
    ArrayList<ClockEntry> entries =
            new ArrayList<ClockEntry>();
    if (tvc.getVersions() != null) {
        for (org.sdnplatform.sync.thrift.ClockEntry ce :
            tvc.getVersions()) {
            entries.add(new ClockEntry(ce.getNodeId(), ce.getVersion()));
        }
    }
    return new VectorClock(entries, tvc.getTimestamp());
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:TProtocolUtil.java

示例4: testMergeWithLargeVersion

import org.sdnplatform.sync.internal.version.ClockEntry; //导入依赖的package包/类
/**
 * See gihub issue #25: Incorrect coersion of version to short before
 * passing to ClockEntry constructor
 */
@Test
public void testMergeWithLargeVersion() {
    VectorClock clock1 = getClock(1);
    VectorClock clock2 = new VectorClock(Lists.newArrayList(new ClockEntry((short) 1,
                                                                           Short.MAX_VALUE + 1)),
                                         System.currentTimeMillis());
    VectorClock mergedClock = clock1.merge(clock2);
    assertEquals(mergedClock.getMaxVersion(), Short.MAX_VALUE + 1);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:14,代码来源:VectorClockTest.java

示例5: testIncrement

import org.sdnplatform.sync.internal.version.ClockEntry; //导入依赖的package包/类
@Test
public void testIncrement() {
    ClockEntry v = new ClockEntry((short) 0, 1);
    assertEquals(v.getNodeId(), 0);
    assertEquals(v.getVersion(), 1);
    ClockEntry v2 = v.incremented();
    assertEquals(v.getVersion(), 1);
    assertEquals(v2.getVersion(), 2);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:10,代码来源:ClockEntryTest.java


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