src/Generic/propositions/sem_tree/SemNode.cpp
// Remove links on our parents and siblings that point to us.
// Leave our pointers back to them untouched.

Remove links on our parents and siblings that point to us.
Leave our pointers back to them untouched.
Remove links on our parents and siblings that point to us . Leave our pointers back to them untouched .
void SemNode::pruneOut() {
	if (_regularized == true) {
		throw InternalInconsistencyException("SemNode::pruneOut()",
			"This method doesn't work after the sem tree has been regularized!");
	}
	if (_parent == 0) {
		throw InternalInconsistencyException("SemNode::pruneOut()",
			"Illegal attempt to manipulate structure of root node");
	}
	if (_parent->_firstChild == this) {
		_parent->_firstChild = _next;
		if (_parent->_lastChild == this) {
			_parent->_lastChild = 0;
		}
	} else {
		SemNode *node = _parent->_firstChild;
		while (node != 0) {
			if (node->_next == this) {
				node->_next = _next;
			}
			_parent->_lastChild = node;
			node = node->_next;
		}
	}
}
void SemNode :: pruneOut ( ) { if ( _regularized == true ) { throw InternalInconsistencyException ( " " , " " ) ; } if ( _parent == 0 ) { throw InternalInconsistencyException ( " " , " " ) ; } if ( _parent -> _firstChild == this ) { _parent -> _firstChild = _next ; if ( _parent -> _lastChild == this ) { _parent -> _lastChild = 0 ; } } else { SemNode * node = _parent -> _firstChild ; while ( node != 0 ) { if ( node -> _next == this ) { node -> _next = _next ; } _parent -> _lastChild = node ; node = node -> _next ; } } }
Remove links on our parents and siblings that point to us.
Remove links on our parents and siblings that point to us .
// only child; parent left with no children
