<commit_before>import Class from 'lowclass'
import native from 'lowclass/native'
import {withUpdate} from '@trusktr/skatejs'
import Mixin from './Mixin'
import {isInstanceof} from './Utility'
import TreeNode from './TreeNode'

export default
Mixin(Base =>

    Class('TreeNode').extends( native( withUpdate( Base ) ), ({ Super, Public: Private }) => ({

        // TODO, make Private work with Mixin+lowclass. The problem is when
        // using `Private` on instance of the same class created by a different
        // mixin application. We may have to do something similar to the
        // hasInstance Mixin helper.
        //private: {
            _parent: null,
            _children: null,
        //},

        constructor(...args) {
            const self = Super(this).constructor(...args)<commit_msg>Add TreeNode.traverse public method to make it easy to traverse a tree<commit_after>import Class from 'lowclass'
import native from 'lowclass/native'
import {withUpdate} from '@trusktr/skatejs'
import Mixin from './Mixin'
import {isInstanceof} from './Utility'
import TreeNode from './TreeNode'

export default
Mixin(Base =>

    Class('TreeNode').extends( native( withUpdate( Base ) ), ({ Super, Public: Private }) => ({

        // TODO, make Private work with Mixin+lowclass. The problem is when
        // using `Private` on instance of the same class created by a different
        // mixin application. We may have to do something similar to the
        // hasInstance Mixin helper.
        //private: {
            _parent: null,
            _children: null,

            __traverse(fn) {
                fn(this)

                const children = this._children
                for (let i = 0, l = children.length; i < l; i++) {
                    console.log( 'CHILD!', children[i] )
                    Private(children[i]).__traverse(fn)
                }
            },
        //},

        // traverse the tree at this node
        traverse(fn) {
            Private(this).__traverse(fn)
        },

        constructor(...args) {
            const self = Super(this).constructor(...args)
{'fraction_non_alphanumeric': 0.1130558183538316, 'fraction_numerical': 0.0004730368968779565, 'mean_word_length': 2.1426448736998513, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2184803', 'n_tokens_mistral': 575, 'n_tokens_neox': 557, 'n_words': 194}