ITreeAdaptorBecomeRoot Method (Object, Object) |
If oldRoot is a nil root, just copy or move the children to newRoot.
If not a nil root, make oldRoot a child of newRoot.
Namespace:
Stimulsoft.Data.Expressions.Antlr.Runtime.Tree
Assembly:
Stimulsoft.Data (in Stimulsoft.Data.dll) Version: 2019.3.1.0
SyntaxObject BecomeRoot(
Object newRoot,
Object oldRoot
)
Function BecomeRoot (
newRoot As Object,
oldRoot As Object
) As Object
Parameters
- newRoot
- Type: SystemObject
[Missing <param name="newRoot"/> documentation for "M:Stimulsoft.Data.Expressions.Antlr.Runtime.Tree.ITreeAdaptor.BecomeRoot(System.Object,System.Object)"]
- oldRoot
- Type: SystemObject
[Missing <param name="oldRoot"/> documentation for "M:Stimulsoft.Data.Expressions.Antlr.Runtime.Tree.ITreeAdaptor.BecomeRoot(System.Object,System.Object)"]
Return Value
Type:
Object[Missing <returns> documentation for "M:Stimulsoft.Data.Expressions.Antlr.Runtime.Tree.ITreeAdaptor.BecomeRoot(System.Object,System.Object)"]
Remarks
old=^(nil a b c), new=r yields ^(r a b c)
old=^(a b c), new=r yields ^(r ^(a b c))
If newRoot is a nil-rooted single child tree, use the single
child as the new root node.
old=^(nil a b c), new=^(nil r) yields ^(r a b c)
old=^(a b c), new=^(nil r) yields ^(r ^(a b c))
If oldRoot was null, it's ok, just return newRoot (even if isNil).
old=null, new=r yields r
old=null, new=^(nil r) yields ^(nil r)
Return newRoot. Throw an exception if newRoot is not a
simple node or nil root with a single child node--it must be a root
node. If newRoot is ^(nil x) return x as newRoot.
Be advised that it's ok for newRoot to point at oldRoot's
children; i.e., you don't have to copy the list. We are
constructing these nodes so we should have this control for
efficiency.
See Also