internal static IEnumerable <T> Enumerate(KeyManager.LinkedList <T> current)
 {
     for (; current != null; current = current._previous)
     {
         yield return(current._value);
     }
 }
        private IEnumerable <int> WalkGraph(
            int identifier,
            Func <KeyManager.IdentifierInfo, KeyManager.LinkedList <int> > successorFunction,
            bool leavesOnly)
        {
            Stack <int> stack = new Stack <int>();

            stack.Push(identifier);
            while (stack.Count > 0)
            {
                int currentIdentifier = stack.Pop();
                KeyManager.LinkedList <int> successors = successorFunction(this._identifiers[currentIdentifier]);
                if (successors != null)
                {
                    foreach (int num in KeyManager.LinkedList <int> .Enumerate(successors))
                    {
                        stack.Push(num);
                    }
                    if (!leavesOnly)
                    {
                        yield return(currentIdentifier);
                    }
                }
                else
                {
                    yield return(currentIdentifier);
                }
            }
        }
 internal IEnumerable <int> GetDirectReferences(int identifier)
 {
     KeyManager.LinkedList <int> references = this._identifiers[identifier].References;
     foreach (int num in KeyManager.LinkedList <int> .Enumerate(references))
     {
         yield return(num);
     }
 }
        private void ValidateReferentialIntegrityGraphAcyclic(
            int node,
            byte[] color,
            KeyManager.LinkedList <int> parent)
        {
            color[node] = (byte)2;
            KeyManager.LinkedList <int> .Add(ref parent, node);

            foreach (int node1 in KeyManager.LinkedList <int> .Enumerate(this._identifiers[node].References))
            {
                switch (color[node1])
                {
                case 0:
                    this.ValidateReferentialIntegrityGraphAcyclic(node1, color, parent);
                    continue;

                case 2:
                    List <IEntityStateEntry> source = new List <IEntityStateEntry>();
                    foreach (int index in KeyManager.LinkedList <int> .Enumerate(parent))
                    {
                        PropagatorResult owner = this._identifiers[index].Owner;
                        if (owner != null)
                        {
                            source.Add(owner.StateEntry);
                        }
                        if (index == node1)
                        {
                            break;
                        }
                    }
                    throw new UpdateException(Strings.Update_CircularRelationships, (Exception)null, source.Cast <ObjectStateEntry>().Distinct <ObjectStateEntry>());

                default:
                    continue;
                }
            }
            color[node] = (byte)1;
        }
 internal static void Add(ref KeyManager.LinkedList <T> list, T value)
 {
     list = new KeyManager.LinkedList <T>(value, list);
 }
 private LinkedList(T value, KeyManager.LinkedList <T> previous)
 {
     this._value    = value;
     this._previous = previous;
 }