if (debugrates) { if (librarydebug) { System.err.print(feedbackLoop.getObject(). getClass().getName()); } else { System.err.print(((SIRStream)feedbackLoop.getObject()) .getIdent()); } System.err.println(" steady state: push " + push + " pop " + pop); }
    public void computeSteadyState()    {        // amount of data distributed to and collected by the split        // and join        int splitPushWeights[];        int joinPopWeights[];        int splitPopWeight, joinPushWeight;        // now, assuming the body executes once, compute fractions        // of how many times everything else executes        {            BigInteger bodyPush, bodyPop;            BigInteger loopPush, loopPop;            bodyPush = BigInteger.valueOf(body.getSteadyPush());            bodyPop = BigInteger.valueOf(body.getSteadyPop());            loopPush = BigInteger.valueOf(loop.getSteadyPush());            loopPop = BigInteger.valueOf(loop.getSteadyPop());            BigInteger splitPush, splitPop;            BigInteger joinPush, joinPop;            // get the feedback production rate and others            splitPush =                BigInteger.valueOf(getSteadySplitFlow().getPushWeight(1));            splitPop =                BigInteger.valueOf(getSteadySplitFlow().getPopWeight());            joinPop = BigInteger.valueOf(getSteadyJoinFlow().getPopWeight(1));            joinPush =                BigInteger.valueOf(getSteadyJoinFlow().getPushWeight());            // calculate all the fractions            Fraction bodyFrac = new Fraction(BigInteger.ONE, BigInteger.ONE);            Fraction splitFrac =                new Fraction(bodyPush, splitPop).multiply(bodyFrac);            Fraction loopFrac =                new Fraction(splitPush, loopPop).multiply(splitFrac);            Fraction joinFrac =                new Fraction(loopPush, joinPop).multiply(loopFrac);            // make sure that the rates are self consistant            if (!joinFrac                .multiply(joinPush)                .divide(bodyPop)                .equals(bodyFrac))            {                ERROR("Inconsistant program - cannot be scheduled without growing buffers infinitely!");            }            // compute a minimal multiplier for all the fractions            // s.t. multiplying the fractions by the multiplier will yield            // all integers            BigInteger multiplier = bodyFrac.getDenominator();            multiplier =                multiplier.multiply(                    splitFrac.getDenominator().divide(                        multiplier.gcd(splitFrac.getDenominator())));            multiplier =                multiplier.multiply(                    loopFrac.getDenominator().divide(                        multiplier.gcd(loopFrac.getDenominator())));            multiplier =                multiplier.multiply(                    joinFrac.getDenominator().divide(                        multiplier.gcd(joinFrac.getDenominator())));            // multiply all the fractions by the multiplier            bodyFrac = bodyFrac.multiply(multiplier);            splitFrac = splitFrac.multiply(multiplier);            loopFrac = loopFrac.multiply(multiplier);            joinFrac = joinFrac.multiply(multiplier);            // make sure that all the fractions are integers now            assert bodyFrac.getDenominator().equals(BigInteger.ONE);            assert loopFrac.getDenominator().equals(BigInteger.ONE);            assert joinFrac.getDenominator().equals(BigInteger.ONE);            assert splitFrac.getDenominator().equals(BigInteger.ONE);            // and now actually set the appropriate multipliers on body and loop            // and split and join:            bodyNumExecs = bodyFrac.getNumerator().intValue();            loopNumExecs = loopFrac.getNumerator().intValue();            joinNumRounds = joinFrac.getNumerator().intValue();            splitNumRounds = splitFrac.getNumerator().intValue();            // make sure that both children, splitter and joiner will            // execute a positive # of times            assert bodyNumExecs > 0;            assert loopNumExecs > 0;            assert joinNumRounds > 0;            assert splitNumRounds > 0;                    }        // setup my variables that come from SchedStream:        {            int pop = joinNumRounds * getSteadyJoinFlow().getPopWeight(0);            int push = splitNumRounds * getSteadySplitFlow().getPushWeight(0);            setSteadyPeek(pop);            setSteadyPop(pop);            setSteadyPush(push);        }    }