private OFFactory computeInitialFactory(Set<OFVersion> ofVersions){
  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;
    }
  }
  return OFFactories.getFactory(highest);
}

private OFFactory computeInitialFactory ( Set < OFVersion > ofVersions ) { 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 ; } } return OFFactories . getFactory ( highest ) ; }
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 .
