TimeSpanSet[] tsSets = {currentRFDs, addedRFDInfos};
Collection opConInfoRelays = new ArrayList();
  protected void processPotentialChangedOpCons() {    TimeSpanSet currentRFDs = new TimeSpanSet();    TimeSpanSet addedRFDInfos = new TimeSpanSet();    TimeSpanSet removedRFDs = new TimeSpanSet();    TimeSpanSet[] tsSets = {currentRFDs, addedRFDInfos};    // Go thru current set of RFD tasks and extract the start    //  and end times as well as the operational superior    // Make RFDInfo objects to be compared against    for (Iterator it = myRFDSubscription.iterator(); it.hasNext(); ) {      Task rfdTask = (Task) it.next();      RFDInfo rfdInfo = new RFDInfo(rfdTask);      currentRFDs.add(rfdInfo);      if (myLogger.isInfoEnabled()) {	myLogger.info(getAgentIdentifier()+" from RFD opSup is: " + 		      rfdInfo.getMyOpSuperior() + 		      " startTime is: " + new java.util.Date(rfdInfo.getStartTime()) 		      + " and endTime is: " + new java.util.Date(rfdInfo.getEndTime()));      }    }    for (Iterator i = myOrgActivitySubscription.iterator(); i.hasNext(); ) {      OrgActivity oa = (OrgActivity) i.next();      String adCon = oa.getAdCon();      String opCon = oa.getOpCon();      long oaStart = oa.getStartTime();      long oaEnd = oa.getEndTime();      // Error checking inspired by bug 3790      if (opCon == null) {	if (myLogger.isErrorEnabled())	  myLogger.error(getAgentIdentifier() + " Null opCon from OrgActivity. AdCon: " + adCon + ", start: " + oaStart + ", ActivityType: " + oa.getActivityType() + " ActivityName: " + oa.getActivityName());	opCon = adCon;	if (adCon == null) {	  if (myLogger.isErrorEnabled())	    myLogger.error("Null AdCon too! Bad OrgActivity!");	  continue;	}      }      //need to compare the opcon from the org activity to see if its different      // from the OperationalSuperior in the ReportForDuty tasks for the      // corresponding timespan of the OrgActivity.  If so...      // Send a relay to get itemId, and typeId from opcon       //go thru current rfds first then added      // to check for any overlapping timespans      for (int k = 0; k < tsSets.length; k++) {        TimeSpanSet tsSet = tsSets[k];        Collection affectedRFDs = tsSet.intersectingSet(oa);        for (Iterator j = affectedRFDs.iterator(); j.hasNext(); ) {          //found an overlapping timespan           // now check if opcon is different          RFDInfo existingRFD = (RFDInfo)j.next();          if (!existingRFD.getMyOpSuperior().equals(opCon)) {            if (myLogger.isInfoEnabled()) {              myLogger.info(getAgentIdentifier() + 			    " OpCon from OrgActivity does not match overlapping RFD superior!");            }            //need to make a new rfd for this timspan            tsSet.remove(existingRFD); // Don't know where it will end up,            //  but it can't be here anymore            // See if any part is still viable            long existingStartTime = existingRFD.getStartTime();            long existingEndTime = existingRFD.getEndTime();            //if the existingActivity came from the set of currentRFDs            //  it should be removed from blackboard ultimately because            //  we will copy the info and make a new one for part and            //  the newly read OA will cover the other part.            boolean existingRFDNeedsRemove = (tsSet == currentRFDs);            if (existingStartTime < oaStart) {              //the new RFD starts later than the existing one so              // there is a slice of the existing RFD at the start               // that is still valid.              TimeSpan newTimeSpan = new TimeSpan(existingStartTime, oaStart);              // Need new RFD like the existingRFD              NewTask newRFD = makeRFD(newTimeSpan, existingRFD.getTask());              if (myLogger.isInfoEnabled()) {                myLogger.info(getAgentIdentifier() + 			      ": Beginning of old RFD still valid. New/Copied RFD is:" +			      newRFD);              }              addedRFDInfos.add(new RFDInfo(newRFD));            }            //Now need to check if the new timespan goes longer than the existing            if (existingEndTime > oaEnd) {               //the new timespan ends earlier than the existing one in RFD so              // there is a slice of the existing RFD at the end               // that is still valid.              TimeSpan aNewTimeSpan = new TimeSpan(oaEnd, existingEndTime);              // Need new RFD like the existingRFD              NewTask aNewRFD = makeRFD(aNewTimeSpan, existingRFD.getTask());              if (myLogger.isInfoEnabled()) {                myLogger.info(getAgentIdentifier() +			      "End of old RFD still valid. New/Copied RFD is: " + 			      aNewRFD);              }              addedRFDInfos.add(new RFDInfo(aNewRFD));            }            if (existingRFDNeedsRemove) {              getBlackboardService().publishRemove(existingRFD.getTask());              if (myLogger.isInfoEnabled()) {                myLogger.info("Removing RFD from blackboard: "+ existingRFD.getTask());              }            }            //sending a relay to the opcon from the orgActivity            MessageAddress targetAddr = MessageAddress.getMessageAddress(opCon);                    //extract the start and end time of the relationship from the OA timespan            TimeSpan oaTimeSpan = new TimeSpan(oaStart, oaEnd);                    OpConInfoRelay opconRelay = new OpConInfoRelay(getUIDService().nextUID(),                                                           myAgentAddr,                                                           targetAddr,                                                           oaTimeSpan,                                                           null);            if (myLogger.isInfoEnabled()) {              myLogger.info(getAgentIdentifier()+" just created an OpConInfoRelay: " + 			    opconRelay.toString()                            + " from " + myAgentAddr + " to "  + targetAddr);            }            getBlackboardService().publishAdd(opconRelay);          }        }      }    }    if (myLogger.isInfoEnabled())      myLogger.info(getAgentIdentifier() + 		    " processPotentialChangedOpCons: adding  " + 		    addedRFDInfos.size() + " RFDs , removing " +		    removedRFDs.size() + " RFDs.");    for (Iterator j = removedRFDs.iterator(); j.hasNext(); ) {      Task rfd = (Task) j.next();      getBlackboardService().publishRemove(rfd);      if (myLogger.isInfoEnabled())	myLogger.info(getAgentIdentifier() + "- Removing RFD: " + rfd);    }            for (Iterator j = addedRFDInfos.iterator(); j.hasNext(); ) {      Task rfd = ((RFDInfo) j.next()).getTask();      getBlackboardService().publishAdd(rfd);      if (myLogger.isInfoEnabled())	myLogger.info(getAgentIdentifier() + "- Adding RFD: " + rfd);    }  }