-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
180 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package node | ||
|
||
// Stats contains statistical information for a node. | ||
type Stats struct { | ||
// Descendants is the number of descendant nodes for | ||
// this particular node. | ||
Descendants uint32 | ||
} | ||
|
||
// GetDescendants returns the number of descendants in the branch. | ||
func (b *Branch) GetDescendants() (descendants uint32) { | ||
return b.Stats.Descendants | ||
} | ||
|
||
// AddDescendants adds descendant nodes count to the node stats. | ||
func (b *Branch) AddDescendants(n uint32) { | ||
b.Stats.Descendants += n | ||
} | ||
|
||
// SubDescendants subtracts descendant nodes count from the node stats. | ||
func (b *Branch) SubDescendants(n uint32) { | ||
b.Stats.Descendants -= n | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package node |
Oops, something went wrong.