本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFVersion.values方法的典型用法代码示例。如果您正苦于以下问题:Java OFVersion.values方法的具体用法?Java OFVersion.values怎么用?Java OFVersion.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.projectfloodlight.openflow.protocol.OFVersion
的用法示例。
在下文中一共展示了OFVersion.values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeOFVersionFromBitmap
import org.projectfloodlight.openflow.protocol.OFVersion; //导入方法依赖的package包/类
/**
* Determine the highest supported version of OpenFlow in common
* between both our OFVersion bitmap and the switch's.
*
* @param theirs, the version bitmaps of the switch
* @return the highest OFVersion in common b/t the two
*/
private OFVersion computeOFVersionFromBitmap(List<U32> theirs) {
Iterator<U32> theirsItr = theirs.iterator();
Iterator<U32> oursItr = ofBitmaps.iterator();
OFVersion version = null;
int pos = 0;
int size = 32;
while (theirsItr.hasNext() && oursItr.hasNext()) {
int t = theirsItr.next().getRaw();
int o = oursItr.next().getRaw();
int common = t & o; /* Narrow down the results to the common bits */
for (int i = 0; i < size; i++) { /* Iterate over and locate the 1's */
int tmp = common & (1 << i); /* Select the bit of interest, 0-31 */
if (tmp != 0) { /* Is the version of this bit in common? */
for (OFVersion v : OFVersion.values()) { /* Which version does this bit represent? */
if (v.getWireVersion() == i + (size * pos)) {
version = v;
}
}
}
}
pos++; /* OFVersion position. 1-31 = 1, 32 - 63 = 2, etc. Inc at end so it starts at 0. */
}
return version;
}