natix.CompactDS.WTM.SaveNode C# (CSharp) Method

SaveNode() private method

private SaveNode ( BinaryWriter Output, WTM_Node node ) : void
Output System.IO.BinaryWriter
node WTM_Node
return void
        void SaveNode(BinaryWriter Output, WTM_Node node)
        {
            var asInner = node as WTM_Inner;
            if (asInner != null) {
                // isInner?
                Output.Write (true);
                var arity = asInner.CHILDREN.Length;
                Output.Write ((int)arity);
                GenericIO<Sequence>.Save(Output, asInner.SEQ);
                for (int i = 0; i < arity; ++i) {
                    var child = asInner.CHILDREN[i];
                    if (child == null) {
                        Output.Write (false);
                    } else {
                        Output.Write(true);
                        this.SaveNode(Output, child);
                    }
                }
            } else {
                Output.Write (false);
                var asLeaf = node as WTM_Leaf;
                // Output.Write ((int)asLeaf.Count);
                Output.Write ((int)asLeaf.Symbol);
            }
        }