remaining = initItemsReceived() -
int initItemsRec = 0; if (traceNode.getPrevious().isFilterTrace()) { FilterContent filterC = ((FilterTraceNode)traceNode.getPrevious()).getFilter(); initItemsRec = filterC.getPushInt() * filterC.getInitMult(); if (filterC.isTwoStage()) { initItemsRec -= filterC.getPushInt(); initItemsRec += filterC.getInitPush(); } } else { InputTraceNode in = (InputTraceNode)traceNode.getPrevious();   for (int i = 0; i < in.getWeights().length; i++) { Edge incoming = in.getSources()[i]; FilterContent filterC = ((FilterTraceNode)incoming.getSrc().getPrevious()).getFilter();  int upstreamInitItems = 0; upstreamInitItems = filterC.getPushInt() * filterC.getInitMult(); if (filterC.isTwoStage()) { upstreamInitItems -= filterC.getPushInt(); upstreamInitItems += filterC.getInitPush(); } initItemsRec = (int)((double)upstreamInitItems * incoming.getSrc().ratio(incoming)); } } remaining = initItemsRec -
    private int calculateRemaining()     {	//the number of times this filter fires in the initialization	//schedule	int initFire = initMult;	//if this is not a twostage, fake it by adding to initFire,	//so we always think the preWork is called	//if (!(filter instanceof SIRTwoStageFilter))	if(filter.isTwoStage())	    initFire++;		//see my thesis for an explanation of this calculation	if (initFire  - 1 > 0) {	    bottomPeek = Math.max(0, 				  peek - (prePeek - prePop));	}	else	    bottomPeek = 0;		remaining = initItemsReceived() -	    (prePeek + 	     bottomPeek + 	     Math.max((initFire - 2), 0) * pop);		return remaining;    }