private ATM() { cardExists = new stateCardExists(this); noCard = new stateNoCard(this); pinExists = new statePinEntered(this); atmState = noCard; }
public void SetState(ATMState state) { if (state == null) { throw new ArgumentNullException(nameof(state)); } _currentState = state; }
public ATM() { NoCard = new NoCardState(this); CardEntered = new CardEnteredState(this); NoMoney = new NoMoneyState(this); PinEntered = new PinEnteredState(this); CurrentState = NoCard; Amount = 1000; }
public ATMMachine() { atmState = new NoCard(this);; if (cashInMachine < 0) { atmState = new NoCash(this); } }
public void EjectDebitCard() { _atmMachineState.EjectDebitCard(); _cardInserted = null; if (_atmMachineState is DebitCardInsertedState) { _atmMachineState = new DebitCardNotInsertedState(); } }
public void InsertDebitCard(Card card) { _cardInserted = card; _server.ReadInformationFromCard(card); _atmMachineState.InsertDebitCard(card); if (_atmMachineState is DebitCardNotInsertedState) { _atmMachineState = new DebitCardInsertedState(_server); } }
public ATMMachine() { Hascard = new hascard(this); Nocard = new nocard(this); Correctpin = new correctpin(this); Outofmoney = new outofmoney(this); atmstate = Nocard; if (money < 0) { atmstate = Outofmoney; } }
public ATMMachine() { hasCard = new HasCard(this); noCard = new NoCard(this); hasCorrectPin = new HasPin(this); atmOutOfMoney = new NoCash(this); atmState = noCard; if (cashInMachine < 0) { atmState = atmOutOfMoney; } }
public void EjectDebitCard() { atmMachineState.EjectDebitCard(); // Debit Card has been ejected so internal state of ATM Machine // has been changed to 'DebitCardNotInsertedState' if (atmMachineState is DebitCardInsertedState) { atmMachineState = new DebitCardNotInsertedState(); Console.WriteLine("ATM Machine internal state has been moved to : " + atmMachineState.GetType().Name); } }
public ATMMachine() { this.hasCard = new HasCard(this); this.noCard = new NoCard(this); this.hasCorrectPin = new HasPin(this); this.atmOutOfMoney = new NoCash(this); this.atmState = this.noCard; if ((this.CashInMachine < 0)) { this.atmState = this.atmOutOfMoney; } }
public ATMMachine() { HasCard = new HasCard(this); NoCard = new NoCard(this); HasCorrectPin = new HasPin(this); AtmOutOfMoney = new NoCash(this); AtmState = NoCard; if (CashInMachine < 0) { AtmState = AtmOutOfMoney; } }
public ATM() { _currentState = new NoCardState(1000, this); }
public CashWithdrawnState(ATMState state) : this(state.DummyCashPresent, state.Atm) { }
public void SetATMState(ATMState newATMState) { currentAtmState = newATMState; }
public ATMMachine(Server server) { _server = server; _cardInserted = null; _atmMachineState = new DebitCardNotInsertedState(); }
public void changeState(ATMState g) { atmstate = g; }
public void SetState(ATMState newState) { this.atmState = newState; }
public void setATMState(ATMState newATMState) { atmState = newATMState; }
public void SetATMState(ATMState state) { atmState = state; }
// This constructor will create new state taking values from old state public NoCashState(ATMState state) : this(state.DummyCashPresent, state.Atm) { }
public ATMMachine() { atmMachineState = new DebitCardNotInsertedState(); }
// This constructor will create new state taking values from old state public CardValidatedState(ATMState state) : this(state.DummyCashPresent, state.Atm) { }