Esempio n. 1
0
        public void Claim(Location.ILocation location, DateTime date)
        {
            // Thread safe, lock free sincronization
            CargoState stateBeforeTransition;
            CargoState previousState = CurrentState;

            do
            {
                stateBeforeTransition = previousState;
                CargoState newValue = stateBeforeTransition.Claim(location, date);
                previousState = Interlocked.CompareExchange <CargoState>(ref this.CurrentState, newValue, stateBeforeTransition);
            }while (previousState != stateBeforeTransition);

            if (!previousState.Equals(this.CurrentState))
            {
                HandlingEventArgs args = new HandlingEventArgs(CurrentState, CurrentState.CalculationDate);

                EventHandler <HandlingEventArgs> handler = Claimed;
                if (null != handler)
                {
                    handler(this, args);
                }
            }
        }
Esempio n. 2
0
 public abstract CargoState Claim(Location.ILocation location, DateTime date);
Esempio n. 3
0
 public abstract CargoState ClearCustoms(Location.ILocation location, DateTime date);
Esempio n. 4
0
 public abstract CargoState Recieve(Location.ILocation location, DateTime date);