Example #1
0
        private Node Execute(SetsRelationType property, Node leftChild, Node rightChild, IDictionary <int, int> transactionDecisions = null, int minimalSupport = 1)
        {
            // Arrange
            ProgressTrackerContainer.CurrentProgressTracker = new EmptyProgressTracker();

            var parent = new Node
            {
                Children = new List <Node> {
                    new Node(), leftChild, new Node(), rightChild, new Node()
                }
            };

            // Act
            new Logic.GRMAlgorithm._Impl.GARMPropertyProcedure(new TIDSetsStorageStrategy()).ApplyProperty(property, parent, leftChild, rightChild,
                                                                                                           transactionDecisions ?? new Dictionary <int, int>(), minimalSupport);

            return(parent);
        }
Example #2
0
        public void ApplyProperty(SetsRelationType property, Node parent, Node leftChild, Node rightChild, IDictionary <int, int> transactionDecisions, int minimalSupport)
        {
            if (property == SetsRelationType.Equality)
            {
                ProgressTrackerContainer.CurrentProgressTracker.EnterSubstep(_applyingGARMPropertySetsEqualSubstepId);

                foreach (var generator in rightChild.Generators)
                {
                    leftChild.Generators.Add(generator);
                }

                parent.Children.Remove(rightChild);

                ProgressTrackerContainer.CurrentProgressTracker.LeaveSubstep(_applyingGARMPropertySetsEqualSubstepId);
            }
            else if (property == SetsRelationType.Difference)
            {
                ProgressTrackerContainer.CurrentProgressTracker.EnterSubstep(_applyingGARMPropertySetsDifferentSubstepId);

                var newChild = new Node();
                _transactionIdsStorageStrategy.SetChildTransactionIDsAndSupport(newChild, leftChild, rightChild);

                if (newChild.Support < minimalSupport)
                {
                    ProgressTrackerContainer.CurrentProgressTracker.LeaveSubstep(_applyingGARMPropertySetsDifferentSubstepId);
                    return;
                }

                newChild.Generators = CopyGenerators(rightChild.Generators);
                _transactionIdsStorageStrategy.SetChildDecisiveness(newChild, leftChild.DecisionsTransactionIDs, rightChild.DecisionsTransactionIDs, transactionDecisions);

                leftChild.Children.Add(newChild);

                ProgressTrackerContainer.CurrentProgressTracker.LeaveSubstep(_applyingGARMPropertySetsDifferentSubstepId);
            }
        }