void _uiController_ArrowChanged(object sender, ArrowChangedEventArgs e) { if (_isRunning) { Diagnostics.Logger.Instance.Log("Handling the arrow changed event."); ArrowContext ac = e.Arrow; Diagnostics.Logger.Instance.Log("Current State: " + ac.CurrentState.ToString()); Diagnostics.Logger.Instance.Log(String.Format("X:{0} Y:{1}", ac.X, ac.Y)); string direction = String.Empty; if (ac.CurrentState.ToString().ToUpper().Contains("RIGHT")) { direction = "R"; } else if (ac.CurrentState.ToString().ToUpper().Contains("LEFT")) { direction = "L"; } else if (ac.CurrentState.ToString().ToUpper().Contains("FORWARD")) { direction = "F"; } UpdateGrid(ac.X, ac.Y, direction); } }
public void CreateArrowSuccess() { ArrowContext arrow = new ArrowContext(new ConcreteStateForward()); arrow.Right(); arrow.Right(); arrow.Left(); }
public void CreateArrowSuccess() { ArrowContext arrow = new ArrowContext(new ConcreteStateForward()); arrow.Right(); arrow.Right(); arrow.Left(); }
public ArrowController(int rows, int columns) { Arrow = new ArrowContext(new ConcreteStateForward()); Arrow.X = 0; Arrow.Y = 0; _rows = rows; _columns = columns; _acea = new ArrowChangedEventArgs(); // TODO: Create a 'Common' configuration class for this. ConfigurationManager.RefreshSection("appSettings"); int speed = Int32.Parse(ConfigurationManager.AppSettings["animationSpeed"]) * 1000; _timer = new Timer(speed); _timer.Elapsed += _timer_Elapsed; }
public override void Left(ArrowContext context) { context.X++; }
public override void Left(ArrowContext context) { context.CurrentState = new ConcreteStateLeft(); context.X++; }
public abstract void Right(ArrowContext context);
public abstract void Forward(ArrowContext context);
public override void Forward(ArrowContext context) { context.CurrentState = new ConcreteStateForward(); context.Y++; }
public override void Left(ArrowContext context) { context.CurrentState = new ConcreteStateLeft(); context.X++; }
public override void Forward(ArrowContext context) { context.Y++; }
public override void Right(ArrowContext context) { context.X--; }
public abstract void Left(ArrowContext context);
private TypeContext type(int _p) { ParserRuleContext _parentctx = Context; int _parentState = State; TypeContext _localctx = new TypeContext(Context, _parentState); TypeContext _prevctx = _localctx; int _startState = 8; EnterRecursionRule(_localctx, 8, RULE_type, _p); try { int _alt; EnterOuterAlt(_localctx, 1); { { _localctx = new BoolContext(_localctx); Context = _localctx; _prevctx = _localctx; State = 63; Match(T__13); } Context.Stop = TokenStream.LT(-1); State = 70; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream, 4, Context); while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { if (ParseListeners != null) { TriggerExitRuleEvent(); } _prevctx = _localctx; { { _localctx = new ArrowContext(new TypeContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_type); State = 65; if (!(Precpred(Context, 2))) { throw new FailedPredicateException(this, "Precpred(Context, 2)"); } State = 66; Match(T__12); State = 67; type(3); } } } State = 72; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream, 4, Context); } } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { UnrollRecursionContexts(_parentctx); } return(_localctx); }
public override void Forward(ArrowContext context) { context.CurrentState = new ConcreteStateForward(); context.Y++; }
public override void Right(ArrowContext context) { context.X--; }
public abstract void Forward(ArrowContext context);
public abstract void Left(ArrowContext context);
public override void Left(ArrowContext context) { context.X++; }
public override void Forward(ArrowContext context) { context.Y++; }
public abstract void Right(ArrowContext context);
public override void Right(ArrowContext context) { context.CurrentState = new ConcreteStateRight(); context.X--; }
public override void Right(ArrowContext context) { context.CurrentState = new ConcreteStateRight(); context.X--; }