changes
This commit is contained in:
@@ -120,13 +120,14 @@ impl RoyaltyTree {
|
||||
}
|
||||
self
|
||||
}
|
||||
fn drill(&mut self, index: usize) {
|
||||
fn get_royalty(&mut self, index: usize) -> FiNum {
|
||||
let mut f=self.forefather();
|
||||
while f!=index {
|
||||
self.capture0(f);
|
||||
f=if f>index { wt_left(f).unwrap() } else { wt_right(f).unwrap() }
|
||||
}
|
||||
self.capture0(f);
|
||||
self.tree[index].acc
|
||||
}
|
||||
fn capture(&mut self, index: usize) {
|
||||
let f=self.forefather();
|
||||
@@ -155,9 +156,10 @@ impl RoyaltyTree {
|
||||
fn forefather(&self) -> usize {
|
||||
wt_forefather(self.tree.len()-1)
|
||||
}
|
||||
fn dump(&self) {
|
||||
fn dump(&mut self) {
|
||||
for index in 0..self.tree.len() {
|
||||
println!("Index {} Weight {} Lazy {} Acc {}",index,self.tree[index].weight,self.tree[index].lazy,self.tree[index].acc);
|
||||
let roy=self.get_royalty(index);
|
||||
println!("Index {} Weight {} Lazy {} Acc {} Royalty {}",index,self.tree[index].weight,self.tree[index].lazy,self.tree[index].acc,roy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user