fn sort_indices(&self, indices: &mut Vec<NodeIndex>) {
        indices.sort_by(
            |node1, node2| match self[*node1].span().cmp(&self[*node2].span()) {
                Ordering::Equal => match (&self[*node1], &self[*node2]) {
                    (Node::NonTerminal(_), Node::Terminal(_)) => Ordering::Greater,
                    (Node::Terminal(_), Node::NonTerminal(_)) => Ordering::Less,
                    (Node::NonTerminal(nt1), Node::NonTerminal(nt2)) => {
                        let order = self
                            .children(*node1)
                            .count()
                            .cmp(&self.children(*node2).count());
                        if order != Ordering::Equal {
                            order
                        } else {
                            nt1.label().cmp(nt2.label())
                        }
                    }
                    (Node::Terminal(t1), Node::Terminal(t2)) => t1.form().cmp(t2.form()),
                },
                ordering => ordering,
            },
        );
    }
// helper method to sort a vec of node indices
// order is determined by:
// 1. lower bound of span (starting point of span)
// 2. upper bound of span (end point of span)
// 3. number of covered indices by span
// 4. Inner nodes before terminal nodes
// 5. alphabetical order
helper method to sort a vec of node indices
order is determined by:
1. lower bound of span (starting point of span)
2. upper bound of span (end point of span)
3. number of covered indices by span
4. Inner nodes before terminal nodes
5. alphabetical order
helper method to sort a vec of node indices order is determined by : 1 . lower bound of span ( starting point of span ) 2 . upper bound of span ( end point of span ) 3 . number of covered indices by span 4 . Inner nodes before terminal nodes 5 . alphabetical order
fn sort_indices(&self, indices: &mut Vec<NodeIndex>) {
        indices.sort_by(
            |node1, node2| match self[*node1].span().cmp(&self[*node2].span()) {
                Ordering::Equal => match (&self[*node1], &self[*node2]) {
                    (Node::NonTerminal(_), Node::Terminal(_)) => Ordering::Greater,
                    (Node::Terminal(_), Node::NonTerminal(_)) => Ordering::Less,
                    (Node::NonTerminal(nt1), Node::NonTerminal(nt2)) => {
                        let order = self
                            .children(*node1)
                            .count()
                            .cmp(&self.children(*node2).count());
                        if order != Ordering::Equal {
                            order
                        } else {
                            nt1.label().cmp(nt2.label())
                        }
                    }
                    (Node::Terminal(t1), Node::Terminal(t2)) => t1.form().cmp(t2.form()),
                },
                ordering => ordering,
            },
        );
    }
fn sort_indices ( & self , indices : & mut Vec < NodeIndex > ) { indices . sort_by ( | node1 , node2 | match self [ * node1 ] . span ( ) . cmp ( & self [ * node2 ] . span ( ) ) { Ordering :: Equal => match ( & self [ * node1 ] , & self [ * node2 ] ) { ( Node :: NonTerminal ( _ ) , Node :: Terminal ( _ ) ) => Ordering :: Greater , ( Node :: Terminal ( _ ) , Node :: NonTerminal ( _ ) ) => Ordering :: Less , ( Node :: NonTerminal ( nt1 ) , Node :: NonTerminal ( nt2 ) ) => { let order = self . children ( * node1 ) . count ( ) . cmp ( & self . children ( * node2 ) . count ( ) ) ; if order != Ordering :: Equal { order } else { nt1 . label ( ) . cmp ( nt2 . label ( ) ) } } ( Node :: Terminal ( t1 ) , Node :: Terminal ( t2 ) ) => t1 . form ( ) . cmp ( t2 . form ( ) ) , } , ordering => ordering , } , ) ; }
helper method to sort a vec of node indices
order is determined by:
1. lower bound of span (starting point of span)
2. upper bound of span (end point of span)
3. number of covered indices by span
4.
helper method to sort a vec of node indices order is determined by : 1 . lower bound of span ( starting point of span ) 2 . upper bound of span ( end point of span ) 3 . number of covered indices by span 4 .
&self
indices
&mut Vec<NodeIndex>
&self
indices
&mut Vec<NodeIndex>