public GumballMachine(int numberGumballs) { count = numberGumballs; soldOutState = new SoldOutState(this); noQuarterState = new NoQuarterState(this); hasQuarterState = new HasQuarterState(this); soldState = new SoldState(this); state = noQuarterState; }
public GumballMachine(int gumballsNum) { remainGumballsNum = gumballsNum; SoldOutState = new SoldOutState(this); NoQuarterState = new NoQuarterState(this); HasQuarterState = new HasQuarterState(this); SoldState = new SoldState(this); currentState = remainGumballsNum > 0 ? NoQuarterState : SoldOutState; }
public GumBallMachine(int gumballs) { SoldOutState = new SoldOutState(this); NoQuarterState = new NoQuarterState(this); HasQuarterState = new HasQuarterState(this); SoldState = new SoldState(this); WinnerState = new WinnerState(this); Gumballs = gumballs; State = gumballs > 0 ? NoQuarterState : SoldOutState; }
public GumballMachine(int numberGumballs) { SoldOutState = new SoldOutState(this); NoQuarterState = new NoQuarterState(this); HasQuarterState = new HasQuarterState(this); SoldState = new SoldState(this); WinnerState = new WinnerState(this); Count = numberGumballs; if (numberGumballs > 0) { State = NoQuarterState; } }
public GumballMachine(int count) { SoldState = new SoldState(this); NoQuarterState = new NoQuarterState(this); HasQuarterState = new HasQuarterState(this); SoldOutState = new SoldOutState(this); CandyCount = count; if (CandyCount > 0) { _state = NoQuarterState; } }
public GumballMachine(string location, int count) { State = SoldOutState; Count = count; Location = location; NoQuarterState = new NoQuarterState(this); HasQuarterState = new HasQuarterState(this); SoldOutState = new SoldOutState(this); SoldState = new SoldState(this); WinnerState = new WinnerState(this); if (count > 0) { State = NoQuarterState; } }