Example #1
0
        public void ApplyTransaction(WireTransaction transaction)
        {
            // Now we have figured out all of the additions and deletions.
            // So now we can actually add and remove the appropriate wires.
            foreach (var dwire in transaction.Deleted)
            {
                if (WiresList.Remove(dwire) == false)
                {
                    Console.WriteLine($"Warn: Tried to remove a wire that didn't exist! {dwire}");
                }
            }

            foreach (var awire in transaction.Created)
            {
                WiresList.Add(awire);
            }
        }
Example #2
0
        public void RevertTransaction(WireTransaction transaction)
        {
            // FIXME: We want to know if this is the last transaction created for the wires.

            // We want to delete the wires that where created and recreate the ones removed

            foreach (var wire in transaction.Created)
            {
                if (WiresList.Remove(wire) == false)
                {
                    Console.WriteLine($"Warn: Removing non-existent wire when reverting transaction! ({wire})");
                }
            }

            foreach (var wire in transaction.Deleted)
            {
                WiresList.Add(wire);
            }
        }
Example #3
0
        public void ApplyTransaction(WireTransaction transaction)
        {
            // Now we have figured out all of the additions and deletions.
            // So now we can actually add and remove the appropriate wires.
            foreach (var dwire in transaction.Deleted)
            {
                if (WiresList.Remove(dwire) == false)
                {
                    Console.WriteLine($"Warn: Tried to remove a wire that didn't exist! {dwire}");
                }
            }

            foreach (var awire in transaction.Created)
            {
                WiresList.Add(awire);
            }

            // Re-calculate the bundles
            // FIXME: We might want to make this more efficient!
            Bundles = CreateBundlesFromWires(WiresList);
        }