Interface implementation assertions moved outside the functions

pull/197/head
Emir Pasic 2 years ago
parent 363df0e21f
commit e2b92bbc7a

@ -17,9 +17,8 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertListImplementation() { // Assert List implementation
var _ lists.List = (*List)(nil) var _ lists.List = (*List)(nil)
}
// List holds the elements in a slice // List holds the elements in a slice
type List struct { type List struct {

@ -6,9 +6,8 @@ package arraylist
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithIndex = (*List)(nil) var _ containers.EnumerableWithIndex = (*List)(nil)
}
// Each calls the given function once for each element, passing that element's index and value. // Each calls the given function once for each element, passing that element's index and value.
func (list *List) Each(f func(index int, value interface{})) { func (list *List) Each(f func(index int, value interface{})) {

@ -6,9 +6,8 @@ package arraylist
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -9,10 +9,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*List)(nil) var _ containers.JSONSerializer = (*List)(nil)
var _ containers.JSONDeserializer = (*List)(nil) var _ containers.JSONDeserializer = (*List)(nil)
}
// ToJSON outputs the JSON representation of list's elements. // ToJSON outputs the JSON representation of list's elements.
func (list *List) ToJSON() ([]byte, error) { func (list *List) ToJSON() ([]byte, error) {

@ -17,9 +17,8 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertListImplementation() { // Assert List implementation
var _ lists.List = (*List)(nil) var _ lists.List = (*List)(nil)
}
// List holds the elements, where each element points to the next and previous element // List holds the elements, where each element points to the next and previous element
type List struct { type List struct {

@ -6,9 +6,8 @@ package doublylinkedlist
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithIndex = (*List)(nil) var _ containers.EnumerableWithIndex = (*List)(nil)
}
// Each calls the given function once for each element, passing that element's index and value. // Each calls the given function once for each element, passing that element's index and value.
func (list *List) Each(f func(index int, value interface{})) { func (list *List) Each(f func(index int, value interface{})) {

@ -6,9 +6,8 @@ package doublylinkedlist
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -9,10 +9,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*List)(nil) var _ containers.JSONSerializer = (*List)(nil)
var _ containers.JSONDeserializer = (*List)(nil) var _ containers.JSONDeserializer = (*List)(nil)
}
// ToJSON outputs the JSON representation of list's elements. // ToJSON outputs the JSON representation of list's elements.
func (list *List) ToJSON() ([]byte, error) { func (list *List) ToJSON() ([]byte, error) {

@ -6,9 +6,8 @@ package singlylinkedlist
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithIndex = (*List)(nil) var _ containers.EnumerableWithIndex = (*List)(nil)
}
// Each calls the given function once for each element, passing that element's index and value. // Each calls the given function once for each element, passing that element's index and value.
func (list *List) Each(f func(index int, value interface{})) { func (list *List) Each(f func(index int, value interface{})) {

@ -6,9 +6,8 @@ package singlylinkedlist
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.IteratorWithIndex = (*Iterator)(nil) var _ containers.IteratorWithIndex = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -9,10 +9,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*List)(nil) var _ containers.JSONSerializer = (*List)(nil)
var _ containers.JSONDeserializer = (*List)(nil) var _ containers.JSONDeserializer = (*List)(nil)
}
// ToJSON outputs the JSON representation of list's elements. // ToJSON outputs the JSON representation of list's elements.
func (list *List) ToJSON() ([]byte, error) { func (list *List) ToJSON() ([]byte, error) {

@ -17,9 +17,8 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertListImplementation() { // Assert List implementation
var _ lists.List = (*List)(nil) var _ lists.List = (*List)(nil)
}
// List holds the elements, where each element points to the next element // List holds the elements, where each element points to the next element
type List struct { type List struct {

@ -21,9 +21,8 @@ import (
"github.com/emirpasic/gods/maps/hashmap" "github.com/emirpasic/gods/maps/hashmap"
) )
func assertMapImplementation() { // Assert Map implementation
var _ maps.BidiMap = (*Map)(nil) var _ maps.BidiMap = (*Map)(nil)
}
// Map holds the elements in two hashmaps. // Map holds the elements in two hashmaps.
type Map struct { type Map struct {

@ -9,10 +9,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Map)(nil) var _ containers.JSONSerializer = (*Map)(nil)
var _ containers.JSONDeserializer = (*Map)(nil) var _ containers.JSONDeserializer = (*Map)(nil)
}
// ToJSON outputs the JSON representation of the map. // ToJSON outputs the JSON representation of the map.
func (m *Map) ToJSON() ([]byte, error) { func (m *Map) ToJSON() ([]byte, error) {

@ -16,9 +16,8 @@ import (
"github.com/emirpasic/gods/maps" "github.com/emirpasic/gods/maps"
) )
func assertMapImplementation() { // Assert Map implementation
var _ maps.Map = (*Map)(nil) var _ maps.Map = (*Map)(nil)
}
// Map holds the elements in go's native map // Map holds the elements in go's native map
type Map struct { type Map struct {

@ -10,10 +10,9 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Map)(nil) var _ containers.JSONSerializer = (*Map)(nil)
var _ containers.JSONDeserializer = (*Map)(nil) var _ containers.JSONDeserializer = (*Map)(nil)
}
// ToJSON outputs the JSON representation of the map. // ToJSON outputs the JSON representation of the map.
func (m *Map) ToJSON() ([]byte, error) { func (m *Map) ToJSON() ([]byte, error) {

@ -6,9 +6,8 @@ package linkedhashmap
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithKey = (*Map)(nil) var _ containers.EnumerableWithKey = (*Map)(nil)
}
// Each calls the given function once for each element, passing that element's key and value. // Each calls the given function once for each element, passing that element's key and value.
func (m *Map) Each(f func(key interface{}, value interface{})) { func (m *Map) Each(f func(key interface{}, value interface{})) {

@ -9,9 +9,8 @@ import (
"github.com/emirpasic/gods/lists/doublylinkedlist" "github.com/emirpasic/gods/lists/doublylinkedlist"
) )
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithKey = (*Iterator)(nil) var _ containers.ReverseIteratorWithKey = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -18,9 +18,8 @@ import (
"strings" "strings"
) )
func assertMapImplementation() { // Assert Map implementation
var _ maps.Map = (*Map)(nil) var _ maps.Map = (*Map)(nil)
}
// Map holds the elements in a regular hash table, and uses doubly-linked list to store key ordering. // Map holds the elements in a regular hash table, and uses doubly-linked list to store key ordering.
type Map struct { type Map struct {

@ -11,10 +11,9 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Map)(nil) var _ containers.JSONSerializer = (*Map)(nil)
var _ containers.JSONDeserializer = (*Map)(nil) var _ containers.JSONDeserializer = (*Map)(nil)
}
// ToJSON outputs the JSON representation of map. // ToJSON outputs the JSON representation of map.
func (m *Map) ToJSON() ([]byte, error) { func (m *Map) ToJSON() ([]byte, error) {

@ -6,9 +6,8 @@ package treebidimap
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithKey = (*Map)(nil) var _ containers.EnumerableWithKey = (*Map)(nil)
}
// Each calls the given function once for each element, passing that element's key and value. // Each calls the given function once for each element, passing that element's key and value.
func (m *Map) Each(f func(key interface{}, value interface{})) { func (m *Map) Each(f func(key interface{}, value interface{})) {

@ -9,9 +9,8 @@ import (
rbt "github.com/emirpasic/gods/trees/redblacktree" rbt "github.com/emirpasic/gods/trees/redblacktree"
) )
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithKey = (*Iterator)(nil) var _ containers.ReverseIteratorWithKey = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -10,10 +10,9 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Map)(nil) var _ containers.JSONSerializer = (*Map)(nil)
var _ containers.JSONDeserializer = (*Map)(nil) var _ containers.JSONDeserializer = (*Map)(nil)
}
// ToJSON outputs the JSON representation of the map. // ToJSON outputs the JSON representation of the map.
func (m *Map) ToJSON() ([]byte, error) { func (m *Map) ToJSON() ([]byte, error) {

@ -25,9 +25,8 @@ import (
"strings" "strings"
) )
func assertMapImplementation() { // Assert Map implementation
var _ maps.BidiMap = (*Map)(nil) var _ maps.BidiMap = (*Map)(nil)
}
// Map holds the elements in two red-black trees. // Map holds the elements in two red-black trees.
type Map struct { type Map struct {

@ -9,9 +9,8 @@ import (
rbt "github.com/emirpasic/gods/trees/redblacktree" rbt "github.com/emirpasic/gods/trees/redblacktree"
) )
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithKey = (*Map)(nil) var _ containers.EnumerableWithKey = (*Map)(nil)
}
// Each calls the given function once for each element, passing that element's key and value. // Each calls the given function once for each element, passing that element's key and value.
func (m *Map) Each(f func(key interface{}, value interface{})) { func (m *Map) Each(f func(key interface{}, value interface{})) {

@ -9,9 +9,8 @@ import (
rbt "github.com/emirpasic/gods/trees/redblacktree" rbt "github.com/emirpasic/gods/trees/redblacktree"
) )
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithKey = (*Iterator)(nil) var _ containers.ReverseIteratorWithKey = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -8,10 +8,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Map)(nil) var _ containers.JSONSerializer = (*Map)(nil)
var _ containers.JSONDeserializer = (*Map)(nil) var _ containers.JSONDeserializer = (*Map)(nil)
}
// ToJSON outputs the JSON representation of the map. // ToJSON outputs the JSON representation of the map.
func (m *Map) ToJSON() ([]byte, error) { func (m *Map) ToJSON() ([]byte, error) {

@ -19,9 +19,8 @@ import (
"strings" "strings"
) )
func assertMapImplementation() { // Assert Map implementation
var _ maps.Map = (*Map)(nil) var _ maps.Map = (*Map)(nil)
}
// Map holds the elements in a red-black tree // Map holds the elements in a red-black tree
type Map struct { type Map struct {

@ -15,9 +15,8 @@ import (
"strings" "strings"
) )
func assertSetImplementation() { // Assert Set implementation
var _ sets.Set = (*Set)(nil) var _ sets.Set = (*Set)(nil)
}
// Set holds elements in go's native map // Set holds elements in go's native map
type Set struct { type Set struct {

@ -9,10 +9,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Set)(nil) var _ containers.JSONSerializer = (*Set)(nil)
var _ containers.JSONDeserializer = (*Set)(nil) var _ containers.JSONDeserializer = (*Set)(nil)
}
// ToJSON outputs the JSON representation of the set. // ToJSON outputs the JSON representation of the set.
func (set *Set) ToJSON() ([]byte, error) { func (set *Set) ToJSON() ([]byte, error) {

@ -6,9 +6,8 @@ package linkedhashset
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithIndex = (*Set)(nil) var _ containers.EnumerableWithIndex = (*Set)(nil)
}
// Each calls the given function once for each element, passing that element's index and value. // Each calls the given function once for each element, passing that element's index and value.
func (set *Set) Each(f func(index int, value interface{})) { func (set *Set) Each(f func(index int, value interface{})) {

@ -9,9 +9,8 @@ import (
"github.com/emirpasic/gods/lists/doublylinkedlist" "github.com/emirpasic/gods/lists/doublylinkedlist"
) )
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -20,9 +20,8 @@ import (
"strings" "strings"
) )
func assertSetImplementation() { // Assert Set implementation
var _ sets.Set = (*Set)(nil) var _ sets.Set = (*Set)(nil)
}
// Set holds elements in go's native map // Set holds elements in go's native map
type Set struct { type Set struct {

@ -9,10 +9,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Set)(nil) var _ containers.JSONSerializer = (*Set)(nil)
var _ containers.JSONDeserializer = (*Set)(nil) var _ containers.JSONDeserializer = (*Set)(nil)
}
// ToJSON outputs the JSON representation of the set. // ToJSON outputs the JSON representation of the set.
func (set *Set) ToJSON() ([]byte, error) { func (set *Set) ToJSON() ([]byte, error) {

@ -9,9 +9,8 @@ import (
rbt "github.com/emirpasic/gods/trees/redblacktree" rbt "github.com/emirpasic/gods/trees/redblacktree"
) )
func assertEnumerableImplementation() { // Assert Enumerable implementation
var _ containers.EnumerableWithIndex = (*Set)(nil) var _ containers.EnumerableWithIndex = (*Set)(nil)
}
// Each calls the given function once for each element, passing that element's index and value. // Each calls the given function once for each element, passing that element's index and value.
func (set *Set) Each(f func(index int, value interface{})) { func (set *Set) Each(f func(index int, value interface{})) {

@ -9,9 +9,8 @@ import (
rbt "github.com/emirpasic/gods/trees/redblacktree" rbt "github.com/emirpasic/gods/trees/redblacktree"
) )
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
}
// Iterator returns a stateful iterator whose values can be fetched by an index. // Iterator returns a stateful iterator whose values can be fetched by an index.
type Iterator struct { type Iterator struct {

@ -9,10 +9,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Set)(nil) var _ containers.JSONSerializer = (*Set)(nil)
var _ containers.JSONDeserializer = (*Set)(nil) var _ containers.JSONDeserializer = (*Set)(nil)
}
// ToJSON outputs the JSON representation of the set. // ToJSON outputs the JSON representation of the set.
func (set *Set) ToJSON() ([]byte, error) { func (set *Set) ToJSON() ([]byte, error) {

@ -18,9 +18,8 @@ import (
"strings" "strings"
) )
func assertSetImplementation() { // Assert Set implementation
var _ sets.Set = (*Set)(nil) var _ sets.Set = (*Set)(nil)
}
// Set holds elements in a red-black tree // Set holds elements in a red-black tree
type Set struct { type Set struct {

@ -16,9 +16,8 @@ import (
"strings" "strings"
) )
func assertStackImplementation() { // Assert Stack implementation
var _ stacks.Stack = (*Stack)(nil) var _ stacks.Stack = (*Stack)(nil)
}
// Stack holds elements in an array-list // Stack holds elements in an array-list
type Stack struct { type Stack struct {

@ -6,9 +6,8 @@ package arraystack
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
}
// Iterator returns a stateful iterator whose values can be fetched by an index. // Iterator returns a stateful iterator whose values can be fetched by an index.
type Iterator struct { type Iterator struct {

@ -8,10 +8,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Stack)(nil) var _ containers.JSONSerializer = (*Stack)(nil)
var _ containers.JSONDeserializer = (*Stack)(nil) var _ containers.JSONDeserializer = (*Stack)(nil)
}
// ToJSON outputs the JSON representation of the stack. // ToJSON outputs the JSON representation of the stack.
func (stack *Stack) ToJSON() ([]byte, error) { func (stack *Stack) ToJSON() ([]byte, error) {

@ -6,9 +6,8 @@ package linkedliststack
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.IteratorWithIndex = (*Iterator)(nil) var _ containers.IteratorWithIndex = (*Iterator)(nil)
}
// Iterator returns a stateful iterator whose values can be fetched by an index. // Iterator returns a stateful iterator whose values can be fetched by an index.
type Iterator struct { type Iterator struct {

@ -16,9 +16,8 @@ import (
"strings" "strings"
) )
func assertStackImplementation() { // Assert Stack implementation
var _ stacks.Stack = (*Stack)(nil) var _ stacks.Stack = (*Stack)(nil)
}
// Stack holds elements in a singly-linked-list // Stack holds elements in a singly-linked-list
type Stack struct { type Stack struct {

@ -8,10 +8,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Stack)(nil) var _ containers.JSONSerializer = (*Stack)(nil)
var _ containers.JSONDeserializer = (*Stack)(nil) var _ containers.JSONDeserializer = (*Stack)(nil)
}
// ToJSON outputs the JSON representation of the stack. // ToJSON outputs the JSON representation of the stack.
func (stack *Stack) ToJSON() ([]byte, error) { func (stack *Stack) ToJSON() ([]byte, error) {

@ -15,9 +15,8 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertTreeImplementation() { // Assert Tree implementation
var _ trees.Tree = new(Tree) var _ trees.Tree = new(Tree)
}
// Tree holds elements of the AVL tree. // Tree holds elements of the AVL tree.
type Tree struct { type Tree struct {

@ -6,9 +6,8 @@ package avltree
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithKey = (*Iterator)(nil) var _ containers.ReverseIteratorWithKey = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -10,10 +10,9 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Tree)(nil) var _ containers.JSONSerializer = (*Tree)(nil)
var _ containers.JSONDeserializer = (*Tree)(nil) var _ containers.JSONDeserializer = (*Tree)(nil)
}
// ToJSON outputs the JSON representation of the tree. // ToJSON outputs the JSON representation of the tree.
func (tree *Tree) ToJSON() ([]byte, error) { func (tree *Tree) ToJSON() ([]byte, error) {

@ -19,9 +19,8 @@ import (
"strings" "strings"
) )
func assertTreeImplementation() { // Assert Tree implementation
var _ trees.Tree = (*Heap)(nil) var _ trees.Tree = (*Heap)(nil)
}
// Heap holds elements in an array-list // Heap holds elements in an array-list
type Heap struct { type Heap struct {

@ -6,9 +6,8 @@ package binaryheap
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil) var _ containers.ReverseIteratorWithIndex = (*Iterator)(nil)
}
// Iterator returns a stateful iterator whose values can be fetched by an index. // Iterator returns a stateful iterator whose values can be fetched by an index.
type Iterator struct { type Iterator struct {

@ -8,10 +8,9 @@ import (
"github.com/emirpasic/gods/containers" "github.com/emirpasic/gods/containers"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Heap)(nil) var _ containers.JSONSerializer = (*Heap)(nil)
var _ containers.JSONDeserializer = (*Heap)(nil) var _ containers.JSONDeserializer = (*Heap)(nil)
}
// ToJSON outputs the JSON representation of the heap. // ToJSON outputs the JSON representation of the heap.
func (heap *Heap) ToJSON() ([]byte, error) { func (heap *Heap) ToJSON() ([]byte, error) {

@ -24,9 +24,8 @@ import (
"strings" "strings"
) )
func assertTreeImplementation() { // Assert Tree implementation
var _ trees.Tree = (*Tree)(nil) var _ trees.Tree = (*Tree)(nil)
}
// Tree holds elements of the B-tree // Tree holds elements of the B-tree
type Tree struct { type Tree struct {

@ -6,9 +6,8 @@ package btree
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithKey = (*Iterator)(nil) var _ containers.ReverseIteratorWithKey = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -10,10 +10,9 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Tree)(nil) var _ containers.JSONSerializer = (*Tree)(nil)
var _ containers.JSONDeserializer = (*Tree)(nil) var _ containers.JSONDeserializer = (*Tree)(nil)
}
// ToJSON outputs the JSON representation of the tree. // ToJSON outputs the JSON representation of the tree.
func (tree *Tree) ToJSON() ([]byte, error) { func (tree *Tree) ToJSON() ([]byte, error) {

@ -6,9 +6,8 @@ package redblacktree
import "github.com/emirpasic/gods/containers" import "github.com/emirpasic/gods/containers"
func assertIteratorImplementation() { // Assert Iterator implementation
var _ containers.ReverseIteratorWithKey = (*Iterator)(nil) var _ containers.ReverseIteratorWithKey = (*Iterator)(nil)
}
// Iterator holding the iterator's state // Iterator holding the iterator's state
type Iterator struct { type Iterator struct {

@ -17,9 +17,8 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertTreeImplementation() { // Assert Tree implementation
var _ trees.Tree = (*Tree)(nil) var _ trees.Tree = (*Tree)(nil)
}
type color bool type color bool

@ -10,10 +10,9 @@ import (
"github.com/emirpasic/gods/utils" "github.com/emirpasic/gods/utils"
) )
func assertSerializationImplementation() { // Assert Serialization implementation
var _ containers.JSONSerializer = (*Tree)(nil) var _ containers.JSONSerializer = (*Tree)(nil)
var _ containers.JSONDeserializer = (*Tree)(nil) var _ containers.JSONDeserializer = (*Tree)(nil)
}
// ToJSON outputs the JSON representation of the tree. // ToJSON outputs the JSON representation of the tree.
func (tree *Tree) ToJSON() ([]byte, error) { func (tree *Tree) ToJSON() ([]byte, error) {

Loading…
Cancel
Save