@@ -632,14 +632,14 @@ pub mod node {
632
632
*
633
633
* This is not a strict value
634
634
*/
635
- pub static hint_max_leaf_char_len : uint = 256 u;
635
+ pub static HINT_MAX_LEAF_CHAR_LEN : uint = 256 u;
636
636
637
637
/**
638
638
* The maximal height that _should_ be permitted in a tree.
639
639
*
640
640
* This is not a strict value
641
641
*/
642
- pub static hint_max_node_height : uint = 16 u;
642
+ pub static HINT_MAX_NODE_HEIGHT : uint = 16 u;
643
643
644
644
/**
645
645
* Adopt a string as a node.
@@ -707,26 +707,26 @@ pub mod node {
707
707
char_len : char_len,
708
708
content : str,
709
709
} ) ;
710
- if char_len <= hint_max_leaf_char_len {
710
+ if char_len <= HINT_MAX_LEAF_CHAR_LEN {
711
711
return candidate;
712
712
} else {
713
- //Firstly, split `str` in slices of hint_max_leaf_char_len
714
- let mut leaves = uint:: div_ceil ( char_len, hint_max_leaf_char_len ) ;
713
+ //Firstly, split `str` in slices of HINT_MAX_LEAF_CHAR_LEN
714
+ let mut leaves = uint:: div_ceil ( char_len, HINT_MAX_LEAF_CHAR_LEN ) ;
715
715
//Number of leaves
716
716
let mut nodes = vec:: from_elem ( leaves, candidate) ;
717
717
718
718
let mut i = 0 u;
719
719
let mut offset = byte_start;
720
720
let first_leaf_char_len =
721
- if char_len%hint_max_leaf_char_len == 0 u {
722
- hint_max_leaf_char_len
721
+ if char_len%HINT_MAX_LEAF_CHAR_LEN == 0 u {
722
+ HINT_MAX_LEAF_CHAR_LEN
723
723
} else {
724
- char_len%hint_max_leaf_char_len
724
+ char_len%HINT_MAX_LEAF_CHAR_LEN
725
725
} ;
726
726
while i < leaves {
727
727
let chunk_char_len: uint =
728
728
if i == 0 u { first_leaf_char_len }
729
- else { hint_max_leaf_char_len } ;
729
+ else { HINT_MAX_LEAF_CHAR_LEN } ;
730
730
let chunk_byte_len =
731
731
str. slice_from ( offset) . slice_chars ( 0 , chunk_char_len) . len ( ) ;
732
732
nodes[ i] = @Leaf ( Leaf {
@@ -792,22 +792,22 @@ pub mod node {
792
792
let right_len= char_len ( right) ;
793
793
let mut left_height= height ( left) ;
794
794
let mut right_height=height ( right) ;
795
- if left_len + right_len > hint_max_leaf_char_len {
796
- if left_len <= hint_max_leaf_char_len {
795
+ if left_len + right_len > HINT_MAX_LEAF_CHAR_LEN {
796
+ if left_len <= HINT_MAX_LEAF_CHAR_LEN {
797
797
left = flatten ( left) ;
798
798
left_height = height ( left) ;
799
799
}
800
- if right_len <= hint_max_leaf_char_len {
800
+ if right_len <= HINT_MAX_LEAF_CHAR_LEN {
801
801
right = flatten ( right) ;
802
802
right_height = height ( right) ;
803
803
}
804
804
}
805
- if left_height >= hint_max_node_height {
805
+ if left_height >= HINT_MAX_NODE_HEIGHT {
806
806
left = of_substr_unsafer ( @serialize_node ( left) ,
807
807
0 u, byte_len ( left) ,
808
808
left_len) ;
809
809
}
810
- if right_height >= hint_max_node_height {
810
+ if right_height >= HINT_MAX_NODE_HEIGHT {
811
811
right = of_substr_unsafer ( @serialize_node ( right) ,
812
812
0 u, byte_len ( right) ,
813
813
right_len) ;
@@ -875,7 +875,7 @@ pub mod node {
875
875
*
876
876
* # Algorithm
877
877
*
878
- * * if the node height is smaller than `hint_max_node_height `, do nothing
878
+ * * if the node height is smaller than `HINT_MAX_NODE_HEIGHT `, do nothing
879
879
* * otherwise, gather all leaves as a forest, rebuild a balanced node,
880
880
* concatenating small leaves along the way
881
881
*
@@ -886,7 +886,7 @@ pub mod node {
886
886
* as `node` bot lower height and/or fragmentation.
887
887
*/
888
888
pub fn bal ( node : @Node ) -> Option < @Node > {
889
- if height ( node) < hint_max_node_height { return None ; }
889
+ if height ( node) < HINT_MAX_NODE_HEIGHT { return None ; }
890
890
//1. Gather all leaves as a forest
891
891
let mut forest = ~[ ] ;
892
892
let mut it = leaf_iterator:: start ( node) ;
0 commit comments