Files
dolt/types/value.go
T
Rafael Weinstein d1e2aa01f3 Go: ref.Ref -> hash.Hash (#1583)
ref.Ref -> hash.Hash
2016-05-21 11:38:35 -07:00

37 lines
765 B
Go

package types
import (
"github.com/attic-labs/noms/hash"
)
// Value is implemented by every noms value
type Value interface {
Equals(other Value) bool
Less(other Value) bool
Hash() hash.Hash
// Returns the immediate children of this value in the DAG, if any, not including Type().
ChildValues() []Value
Chunks() []Ref
Type() *Type
}
type ValueSlice []Value
func (vs ValueSlice) Len() int { return len(vs) }
func (vs ValueSlice) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] }
func (vs ValueSlice) Less(i, j int) bool { return vs[i].Less(vs[j]) }
func (vs ValueSlice) Equals(other ValueSlice) bool {
if vs.Len() != other.Len() {
return false
}
for i, v := range vs {
if !v.Equals(other[i]) {
return false
}
}
return true
}