public linkedListOperationExecutor(
     ExecutionSequenceParameters eParams,
     LinkedList <LinkedListItem> list)
 {
     state = new LinkedListExecutionState(list);
     state.AddToKnownNodes(list.First);
     state.AddToKnownNodes(list.Last);
     this.eParams = eParams;
 }
Exemple #2
0
        public override LinkedListNode <LinkedListItem> RunOnLinkedList(LinkedListExecutionState state)
        {
            if (state.Current == null ||
                state.Current == state.List.Last ||
                state.Current == state.List.First)
            {
                return(null);
            }
            ListItemData oldData = state.Current.Value.Data;

            if (oldData.Value != prevalentValue ||
                state.Current.Value.Deleted)
            {
                state.AddToKnownNodes(null);
                return(null);
            }
            return
                (state.AddingToKnownNodes(
                     state.List.AddAfter(state.Current, new LinkedListItem(Value))));
        }