Beispiel #1
0
    public bool Remove(ActiveNode <T> nodeToRemove)
    {
        if (nodeToRemove != null)
        {
            ActiveNode <T> pNode  = nodeToRemove.prevNode;
            ActiveNode <T> nNode  = nodeToRemove.nextNode;
            ActiveNode <T> paNode = nodeToRemove.prevActiveNode;
            ActiveNode <T> naNode = nodeToRemove.nextActiveNode;

            pNode.nextNode = nNode;
            nNode.prevNode = pNode;

            if (paNode != null)
            {
                paNode.nextActiveNode = naNode;
                naNode.prevActiveNode = paNode;
            }

            if (nodeToRemove.IsActive())
            {
                ActiveCount--;
            }
            Count--;
            nodeToRemove = null;

            IsIndexable = false;

            return(true);
        }

        return(false);
    }
Beispiel #2
0
    private void ChangebTriangle(ActiveNode <bTriangle> node, bTriangle newVal, bool activityToggle = false)
    {
        history.AddChange(node, node.data, activityToggle);

        if (newVal != null)
        {
            node.data = newVal;
        }

        if (activityToggle)
        {
            triangles.SetActivity(node, !node.IsActive());
        }
    }
Beispiel #3
0
    private void ChangeVertex(ActiveNode <bVertex> node, bVertex newVal, bVertex oldVal, bool activityToggle = false)
    {
        history.AddChange(node, oldVal, activityToggle);

        if (newVal != null)
        {
            node.data = newVal;
        }

        if (activityToggle)
        {
            vertices.SetActivity(node, !node.IsActive());
        }
    }
Beispiel #4
0
    public void SetActivity(ActiveNode <T> node, bool nodeIsActive)
    {
        if (node.IsActive() == nodeIsActive)
        {
            return;
        }

        if (nodeIsActive)
        {
            ActiveNode <T> it = node;
            while (!it.IsActive())
            {
                it = it.nextNode;
                if (it.isRootNode)
                {
                    break;
                }
            }

            ActiveNode <T> prevActive = it.prevActiveNode;
            node.nextActiveNode = it;
            node.prevActiveNode = prevActive;

            prevActive.nextActiveNode = node;
            it.prevActiveNode         = node;

            ActiveCount++;
        }
        else
        {
            node.prevActiveNode.nextActiveNode = node.nextActiveNode;
            node.nextActiveNode.prevActiveNode = node.prevActiveNode;

            node.nextActiveNode = null;
            node.prevActiveNode = null;

            ActiveCount--;
        }

        IsIndexable = false;
    }