@ Override public final int size ( ) { if ( _size != 0 ) return _size ; // Cached size assert _nodeType == 0 : "unexpected node type: " + _nodeType ; if ( _split . _equal != 0 ) _nodeType |= _split . _equal == 1 ? 4 : ( _split . _equal == 2 ? 8 : 12 ) ; // int res = 7; // 1B node type + flags, 2B colId, 4B float split val // 1B node type + flags, 2B colId, 4B split val/small group or (2B offset + 4B size) + large group int res = _split . _equal == 3 ? 9 + _split . _bs . numBytes ( ) : 7 ; // NA handling correction res ++ ; //1 byte for NA split dir if ( _split . _nasplit == DHistogram . NASplitDir . NAvsREST ) res -= _split . _equal == 3 ? 6 + _split . _bs . numBytes ( ) : 4 ; //don't need certain stuff Node left = _tree . node ( _nids [ 0 ] ) ; int lsz = left . size ( ) ; res += lsz ; if ( left instanceof LeafNode ) _nodeType |= ( byte ) 48 ; else { int slen = lsz < 256 ? 0 : ( lsz < 65535 ? 1 : ( lsz < ( 1 << 24 ) ? 2 : 3 ) ) ; _nodeType |= slen ; // Set the size-skip bits res += ( slen + 1 ) ; // } Node right = _tree . node ( _nids [ 1 ] ) ; if ( right instanceof LeafNode ) _nodeType |= ( byte ) ( 48 << 2 ) ; res += right . size ( ) ; assert ( _nodeType & 0x33 ) != 51 ; assert res != 0 ; return ( _size = res ) ; }
Size of this subtree ; sets _nodeType also