if (mergedSchedule_ == null) {   Vector scheds = getParameterSchedules(); int num_params = scheds.size(); ObjectScheduleElement[] intervals = new ObjectScheduleElement[num_params]; Enumeration[] enums = new Enumeration[num_params]; GLMDebug.DEBUG("ConsumerSpec", num_params + " num params"); ObjectScheduleElement ose; long start = TimeSpan.MAX_VALUE; for (int ii = 0; ii < num_params; ii++) { enums[ii] = ((Schedule) scheds.get(ii)).getAllScheduleElements(); if (enums[ii].hasMoreElements()) { ose = (ObjectScheduleElement) enums[ii].nextElement(); intervals[ii] = ose; if (ose.getStartTime() < start) { start = ose.getStartTime(); } } else { intervals[ii] = null; } }
if (mergedSchedule_ == null) {   Vector scheds = getParameterSchedules(); int num_params = scheds.size(); ObjectScheduleElement[] intervals = new ObjectScheduleElement[num_params]; Enumeration[] enums = new Enumeration[num_params]; if (logger.isDebugEnabled()) { logger.debug(num_params + " num params"); } ObjectScheduleElement ose; long start = TimeSpan.MAX_VALUE; for (int ii = 0; ii < num_params; ii++) { enums[ii] = ((Schedule) scheds.get(ii)).getAllScheduleElements(); if (enums[ii].hasMoreElements()) { ose = (ObjectScheduleElement) enums[ii].nextElement(); intervals[ii] = ose; if (ose.getStartTime() < start) { start = ose.getStartTime(); } } else { intervals[ii] = null; } }
    public Schedule getMergedSchedule() {	if (mergedSchedule_ == null) {	    // sets scheds to Enumerations of schedule elements	    // sets intervals to the initial schedule element within each schedule	    Vector scheds = getParameterSchedules();	    int num_params = scheds.size();	    ObjectScheduleElement[] intervals = new ObjectScheduleElement[num_params];	    Enumeration[] enums = new Enumeration[num_params];	    GLMDebug.DEBUG("ConsumerSpec", num_params + " num params");            ObjectScheduleElement ose;            long start = TimeSpan.MAX_VALUE;	    for (int ii = 0; ii < num_params; ii++) {                enums[ii] = ((Schedule) scheds.get(ii)).getAllScheduleElements();                if (enums[ii].hasMoreElements()) {                    ose = (ObjectScheduleElement) enums[ii].nextElement();                    intervals[ii] = ose;                    if (ose.getStartTime() < start) {                        start = ose.getStartTime();                    }                } else {                    intervals[ii] = null; // Empty schedule                }	    }	    Vector result_sched = new Vector();	    long end = TimeSpan.MIN_VALUE;	    while (end != TimeSpan.MAX_VALUE) {		Vector params = new Vector(num_params);		params.setSize(num_params);                boolean haveParams = false;                end = TimeSpan.MAX_VALUE;		for (int ii = 0; ii < num_params; ii++) {                    params.set(ii, null);// Presume no element for schedule(ii)		    // check if interval good		    ose = intervals[ii];		    if (ose != null) {                        if (ose.getEndTime() <= start) {                            // This has already been covered; Step to next                            if (!enums[ii].hasMoreElements()) {				// ran off end of schedule(ii)                                intervals[ii] = null;                                continue;                            }                            ose = (ObjectScheduleElement) enums[ii].nextElement();                            intervals[ii] = ose;                        }			if (ose.getStartTime() > start) {			    // ose is _not_ part of this result                            // element, it's later (there is a gap)			    if (ose.getStartTime() < end) {                                // This result element ends not later                                // than the start of this pending element				end = ose.getStartTime();			    }                            continue;			}                        // search for earliest end time 			if (ose.getEndTime() < end) {			    end = ose.getEndTime();			}			// add current param to list			params.set(ii, ose.getObject());                        haveParams = true;		    }		}		if (haveParams) {		    result_sched.add(new ObjectScheduleElement(start, end, params));		}                start = end;	    }	    mergedSchedule_ = newObjectSchedule(result_sched.elements());	    GLMDebug.DEBUG("ConsumberSpec", "ConsumerSpec created mergedSchedule "+result_sched.size());	}	return mergedSchedule_;    }