Пример #1
0
 public GumballMachine(int numberGumballs)
 {
     count           = numberGumballs;
     soldOutState    = new SoldOutState(this);
     noQuarterState  = new NoQuarterState(this);
     hasQuarterState = new HasQuarterState(this);
     soldState       = new SoldState(this);
     state           = noQuarterState;
 }
Пример #2
0
 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;
 }
Пример #3
0
        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;
        }
Пример #4
0
 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;
     }
 }
Пример #5
0
        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;
            }
        }
Пример #6
0
 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;
     }
 }