Algorithmix.Cluster.Cluster C# (CSharp) Method

Cluster() public method

Clusters Two INodes together, sets new root/parent/left and right edges
public Cluster ( INode left, INode right, Match match = Match.NonInverted, MatchData matchData = null ) : System
left INode Node on the left
right INode Node on the Right
match Match Inverted or Not Inverted
matchData MatchData Optional MatchData variable, store clustering information
return System
        public Cluster(INode left, INode right, Match match = Match.NonInverted, MatchData matchData = null)
        {
            if (match == Match.Impossible)
            {
                throw new ArgumentException("Match is apparently impossible why are you trying?");
            }

            // Now Build the new nodes
            _left = left;
            _right = right;
            _matchData = matchData;
            _size = left.Size() + right.Size();
            _leftedge = left.LeftEdge();
            _rightedge = right.RightEdge();

            // Set the parents accordingly
            left.Parent(this);
            right.Parent(this);
            _parent = null;

            // change the roots
            _left.Root(this);
            _right.Root(this);

            // Update Count
            Id = _count++;
        }