protected static Collection<OFMessage> pruneInvalidMessages(Iterable<OFMessage> msgList,Collection<OFMessage> valid,OFVersion swVersion,boolean isActive){
  if (isActive) {
    valid.addAll(IterableUtils.toCollection(msgList));
    return Collections.emptyList();
  }
 else {
    Set<OFType> invalidSlaveMsgs=invalidSlaveMsgsByOFVersion.get(swVersion);
    List<OFMessage> invalid=new ArrayList<OFMessage>();
    Iterator<OFMessage> itr=msgList.iterator();
    while (itr.hasNext()) {
      OFMessage m=itr.next();
      if (invalidSlaveMsgs.contains(m.getType())) {
        invalid.add(m);
      }
 else {
        valid.add(m);
      }
    }
    return invalid;
  }
}

protected static Collection < OFMessage > pruneInvalidMessages ( Iterable < OFMessage > msgList , Collection < OFMessage > valid , OFVersion swVersion , boolean isActive ) { if ( isActive ) { valid . addAll ( IterableUtils . toCollection ( msgList ) ) ; return Collections . emptyList ( ) ; } else { Set < OFType > invalidSlaveMsgs = invalidSlaveMsgsByOFVersion . get ( swVersion ) ; List < OFMessage > invalid = new ArrayList < OFMessage > ( ) ; Iterator < OFMessage > itr = msgList . iterator ( ) ; while ( itr . hasNext ( ) ) { OFMessage m = itr . next ( ) ; if ( invalidSlaveMsgs . contains ( m . getType ( ) ) ) { invalid . add ( m ) ; } else { valid . add ( m ) ; } } return invalid ; } }
sorts any invalid messages by moving them from the msglist . the net result is a new list returned containing the invalid messages and a pruned msglist containing only those messages that are valid for the given role of the controller and openflow version of the switch .
