Ejemplo n.º 1
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public LocState(ILoc entity, RailwayState railwayState)
     : base(entity, railwayState)
 {
     address = entity.Address;
     controlledAutomatically = new StateProperty <bool>(this, false, ValidateControlledAutomatically, null, OnControlledAutomaticallyChanged);
     automaticState          = new ActualStateProperty <AutoLocState>(this, AutoLocState.AssignRoute, null, OnAutomaticStateChanged);
     possibleDeadlock        = new ActualStateProperty <bool>(this, false, null, null);
     currentRoute            = new ActualStateProperty <IRouteStateForLoc>(this, null, null, null);
     waitAfterCurrentRoute   = new ActualStateProperty <bool>(this, false, null, null);
     nextRoute    = new ActualStateProperty <IRouteState>(this, null, null, null);
     currentBlock = new ActualStateProperty <IBlockState>(this, null, ValidateCurrentBlock, x => {
         recentlyVisitedBlocks.Insert(x);
         SaveCurrentBlock();
     });
     currentBlockEnterSide           = new ActualStateProperty <BlockSide>(this, BlockSide.Back, null, x => SaveCurrentBlock());
     startNextRouteTime              = new ActualStateProperty <DateTime>(this, DateTime.Now, null, null);
     durationExceedsCurrentRouteTime = new ActualStateProperty <DateTime>(this, DateTime.MaxValue, null, null);
     speedInSteps   = new StateProperty <int>(this, 0, LimitSpeedSteps, OnRequestedSpeedStepsChanged, null);
     speed          = new SpeedProperty(this);
     direction      = new StateProperty <LocDirection>(this, LocDirection.Forward, null, OnRequestedDirectionChanged, x => SaveCurrentBlock());
     reversing      = new ActualStateProperty <bool>(this, false, ValidateReversing, null);
     f0             = new StateProperty <bool>(this, true, null, OnRequestedFunctionChanged, null);
     functionStates = new Dictionary <LocFunction, IStateProperty <bool> >();
     foreach (var lf in entity.Functions)
     {
         var f = new StateProperty <bool>(this, false, null, OnRequestedFunctionChanged, null);
         functionStates[lf.Function] = f;
     }
     lastRouteOptions = new ActualStateProperty <IRouteOption[]>(this, null, null, null);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Default ctor
 /// </summary>
 internal BusyInput(TurnTableState turnTable)
 {
     this.turnTable = turnTable;
     active         = new ActualStateProperty <bool>(turnTable, false, ValidateActive, turnTable.BusyChanged);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Default ctor
 /// </summary>
 protected SensorState(ISensor entity, RailwayState railwayState)
     : base(entity, railwayState)
 {
     address = entity.Address;
     active  = new ActualStateProperty <bool>(this, false, null, OnActiveChanged);
 }