private CycleStage GetRandomStage(int current, int min, int max) // change this trash { CycleStage stage = null; int rnd = _random.Next(0, 3); if (rnd == 0) { stage = new StillCycleStage(current, min, max); } else if (rnd == 1) { stage = new ExpansionCycleStage(current, min, max); } else if (rnd == 2) { stage = new RecessionCycleStage(current, min, max); } return(stage); }
public CycleStage GetStage(int current, int min, int max, bool preferExpansion) { CycleStage stage = null; int toMin = current - min; int toMax = max - current; if (preferExpansion || toMin < _parameters.OffsetToChangeDirection) { stage = new ExpansionCycleStage(current, min, max); } else if (toMax < _parameters.OffsetToChangeDirection) { stage = new RecessionCycleStage(current, min, max); } else { stage = GetRandomStage(current, toMax, toMin); } return(stage); }