| 111 | } |
| 112 | |
| 113 | pub fn next_split(&self) -> HorizontalOrVertical { |
| 114 | match self { |
| 115 | BinaryTree::Empty => HorizontalOrVertical::Horizontal, |
| 116 | BinaryTree::Window(_w) => HorizontalOrVertical::Horizontal, |
| 117 | BinaryTree::Split { |
| 118 | left: _, |
| 119 | right, |
| 120 | split, |
| 121 | ratio: _, |
| 122 | } => { |
| 123 | if let BinaryTree::Split { |
| 124 | left: _, |
| 125 | right: _, |
| 126 | split: _, |
| 127 | ratio: _, |
| 128 | } = right.as_ref() |
| 129 | { |
| 130 | right.next_split() |
| 131 | } else if *split == HorizontalOrVertical::Horizontal { |
| 132 | HorizontalOrVertical::Vertical |
| 133 | } else { |
| 134 | HorizontalOrVertical::Horizontal |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | impl Default for BinaryTree { |