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


Java OFVersion.compareTo方法代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFVersion.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java OFVersion.compareTo方法的具体用法?Java OFVersion.compareTo怎么用?Java OFVersion.compareTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.projectfloodlight.openflow.protocol.OFVersion的用法示例。


在下文中一共展示了OFVersion.compareTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeInitialFactory

import org.projectfloodlight.openflow.protocol.OFVersion; //导入方法依赖的package包/类
/**
 * Find the max version supplied in the supported
 * versions list and use it as the default, which
 * will subsequently be used in our hello message
 * header's version field.
 * 
 * The factory can be later "downgraded" to a lower
 * version depending on what's computed during the
 * version-negotiation part of the handshake.
 * 
 * Assumption: The Set of OFVersion ofVersions
 * variable has been set already and is NOT EMPTY.
 * 
 * @return the highest-version OFFactory we support
 */
private OFFactory computeInitialFactory(Set<OFVersion> ofVersions) {
	/* This should NEVER happen. Double-checking. */
	if (ofVersions == null || ofVersions.isEmpty()) {
		throw new IllegalStateException("OpenFlow version list should never be null or empty at this point. Make sure it's set in the OFSwitchManager.");
	}
	OFVersion highest = null;
	for (OFVersion v : ofVersions) {
		if (highest == null) {
			highest = v;
		} else if (v.compareTo(highest) > 0) {
			highest = v;
		}
	}
	/* 
	 * This assumes highest != null, which
	 * it won't be if the list of versions
	 * is not empty.
	 */
	return OFFactories.getFactory(highest);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:36,代码来源:OFSwitchManager.java

示例2: processOFHello

import org.projectfloodlight.openflow.protocol.OFVersion; //导入方法依赖的package包/类
@Override
void processOFHello(OFHello m) throws IOException {
	OFVersion version = m.getVersion();
	/* Choose the lower of the two supported versions. */
	if (version.compareTo(factory.getVersion()) < 0) {
		factory = OFFactories.getFactory(version);
	} /* else The controller's version is < or = the switch's, so keep original controller factory. */
	
	OFMessageDecoder decoder = pipeline.get(OFMessageDecoder.class);
	decoder.setVersion(version);
	setState(new WaitFeaturesReplyState());
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:13,代码来源:OFChannelHandler.java


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