Exemplo n.º 1
0
 public long?Read()
 {
     if (ReadQueue.Any())
     {
         return(ReadQueue.Dequeue());
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 2
0
        public void TakeOneStep()
        {
            if (IsFinished)
            {
                return;
            }
            if (IsWaiting && ReadQueue.Any())
            {
                IsWaiting = false;
            }
            var currentInstruction = Instructions[CurrentIndex];

            Log($"{ProgramId}: {currentInstruction.GetType().Name}");
            var indexBeforeChange = CurrentIndex;

            currentInstruction.Perform(this);
            if (!IsWaiting && CurrentIndex == indexBeforeChange)
            {
                CurrentIndex++;
            }
        }