-
Notifications
You must be signed in to change notification settings - Fork 129
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
6 changed files
with
414 additions
and
447 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
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 |
---|---|---|
@@ -1,30 +1,16 @@ | ||
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 | ||
} | ||
|
||
// NewStats creates a new Stats structure given the arguments. | ||
func NewStats(descendants uint32) Stats { | ||
return Stats{ | ||
Descendants: descendants, | ||
} | ||
} | ||
|
||
// GetDescendants returns the number of descendants in the branch. | ||
func (b *Branch) GetDescendants() (descendants uint32) { | ||
return b.Stats.Descendants | ||
return b.Descendants | ||
} | ||
|
||
// AddDescendants adds descendant nodes count to the node stats. | ||
func (b *Branch) AddDescendants(n uint32) { | ||
b.Stats.Descendants += n | ||
b.Descendants += n | ||
} | ||
|
||
// SubDescendants subtracts descendant nodes count from the node stats. | ||
func (b *Branch) SubDescendants(n uint32) { | ||
b.Stats.Descendants -= n | ||
b.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
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
Oops, something went wrong.