MCPcopy
hub / github.com/qax-os/excelize / compare

Method compare

crypt.go:714–728  ·  view source on GitHub ↗

compare provides a function to compare object path, each set of sibling objects in one level of the containment hierarchy (all child objects under a storage object) is represented as a red-black tree. The parent object of this set of siblings will have a pointer to the top of this tree.

(left, right string)

Source from the content-addressed store, hash-verified

712// a storage object) is represented as a red-black tree. The parent object of
713// this set of siblings will have a pointer to the top of this tree.
714func (c *cfb) compare(left, right string) int {
715 L, R, i, j := strings.Split(left, "/"), strings.Split(right, "/"), 0, 0
716 for Z := int(math.Min(float64(len(L)), float64(len(R)))); i < Z; i++ {
717 if j = len(L[i]) - len(R[i]); j != 0 {
718 return j
719 }
720 if L[i] != R[i] {
721 if L[i] < R[i] {
722 return -1
723 }
724 return 1
725 }
726 }
727 return len(L) - len(R)
728}
729
730// prepare provides a function to prepare object before write stream.
731func (c *cfb) prepare() {

Callers 2

TestEncryptFunction · 0.95
prepareMethod · 0.95

Calls

no outgoing calls

Tested by 1

TestEncryptFunction · 0.76