graph: make state of empty less contradictory and provide debugging strings

This commit is contained in:
Dan Kortschak
2020-11-25 13:47:53 +10:30
parent 609dabd3fa
commit 0430f3e693

View File

@@ -286,9 +286,9 @@ var (
_ WeightedLineSlicer = Empty _ WeightedLineSlicer = Empty
) )
const nothing = empty(true) const nothing = empty(0)
type empty bool type empty int
func (empty) Next() bool { return false } func (empty) Next() bool { return false }
func (empty) Len() int { return 0 } func (empty) Len() int { return 0 }
@@ -303,3 +303,6 @@ func (empty) Line() Line { return nil }
func (empty) LineSlice() []Line { return nil } func (empty) LineSlice() []Line { return nil }
func (empty) WeightedLine() WeightedLine { return nil } func (empty) WeightedLine() WeightedLine { return nil }
func (empty) WeightedLineSlice() []WeightedLine { return nil } func (empty) WeightedLineSlice() []WeightedLine { return nil }
func (empty) String() string { return "<empty>" }
func (empty) GoString() string { return "graph.Empty" }