refactor: remove dead Copy() code

This commit is contained in:
Matthias Radestock
2017-07-04 06:59:47 +01:00
parent a6491a35c3
commit 4dbb913ca2
10 changed files with 0 additions and 83 deletions

View File

@@ -70,11 +70,6 @@ function generate_latest_map() {
return ${empty_latest_map_variable}
}
// Copy is a noop, as ${latest_map_type}s are immutable.
func (m ${latest_map_type}) Copy() ${latest_map_type} {
return m
}
// Size returns the number of elements.
func (m ${latest_map_type}) Size() int {
if m.Map == nil {

View File

@@ -63,11 +63,6 @@ func MakeNodeControls() NodeControls {
return emptyNodeControls
}
// Copy is a noop, as NodeControls is immutable
func (nc NodeControls) Copy() NodeControls {
return nc
}
// Merge returns the newest of the two NodeControls; it does not take the union
// of the valid Controls.
func (nc NodeControls) Merge(other NodeControls) NodeControls {

View File

@@ -21,11 +21,6 @@ func MakeCounters() Counters {
return emptyCounters
}
// Copy is a noop
func (c Counters) Copy() Counters {
return c
}
// Add value to the counter 'key'
func (c Counters) Add(key string, value int) Counters {
if c.psMap == nil {

View File

@@ -22,11 +22,6 @@ func MakeEdgeMetadatas() EdgeMetadatas {
return emptyEdgeMetadatas
}
// Copy is a noop
func (c EdgeMetadatas) Copy() EdgeMetadatas {
return c
}
// Add value to the counter 'key'
func (c EdgeMetadatas) Add(key string, value EdgeMetadata) EdgeMetadatas {
if c.psMap == nil {

View File

@@ -21,11 +21,6 @@ func (a IDList) Add(ids ...string) IDList {
return IDList(StringSet(a).Add(ids...))
}
// Copy returns a copy of the IDList.
func (a IDList) Copy() IDList {
return IDList(StringSet(a).Copy())
}
// Merge all elements from a and b into a new list
func (a IDList) Merge(b IDList) IDList {
return IDList(StringSet(a).Merge(StringSet(b)))

View File

@@ -37,11 +37,6 @@ func MakeStringLatestMap() StringLatestMap {
return emptyStringLatestMap
}
// Copy is a noop, as StringLatestMaps are immutable.
func (m StringLatestMap) Copy() StringLatestMap {
return m
}
// Size returns the number of elements.
func (m StringLatestMap) Size() int {
if m.Map == nil {
@@ -168,11 +163,6 @@ func MakeNodeControlDataLatestMap() NodeControlDataLatestMap {
return emptyNodeControlDataLatestMap
}
// Copy is a noop, as NodeControlDataLatestMaps are immutable.
func (m NodeControlDataLatestMap) Copy() NodeControlDataLatestMap {
return m
}
// Size returns the number of elements.
func (m NodeControlDataLatestMap) Size() int {
if m.Map == nil {

View File

@@ -103,11 +103,6 @@ func (n NodeSet) ForEach(f func(Node)) {
}
}
// Copy is a noop
func (n NodeSet) Copy() NodeSet {
return n
}
func (n NodeSet) String() string {
buf := bytes.NewBufferString("{")
for _, key := range mapKeys(n.psMap) {

View File

@@ -102,11 +102,6 @@ func (s Sets) Merge(other Sets) Sets {
return Sets{result}
}
// Copy is a noop
func (s Sets) Copy() Sets {
return s
}
func (s Sets) String() string {
return mapToString(s.psMap)
}

View File

@@ -97,13 +97,3 @@ func (s StringSet) Merge(other StringSet) StringSet {
}
}
}
// Copy returns a value copy of the StringSet.
func (s StringSet) Copy() StringSet {
if s == nil {
return s
}
result := make(StringSet, len(s))
copy(result, s)
return result
}

View File

@@ -175,16 +175,6 @@ func (t rowsByID) Len() int { return len(t) }
func (t rowsByID) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
func (t rowsByID) Less(i, j int) bool { return t[i].ID < t[j].ID }
// Copy returns a copy of the Row.
func (r Row) Copy() Row {
entriesCopy := make(map[string]string, len(r.Entries))
for key, value := range r.Entries {
entriesCopy[key] = value
}
r.Entries = entriesCopy
return r
}
// Table is the type for a table in the UI.
type Table struct {
ID string `json:"id"`
@@ -201,24 +191,6 @@ func (t tablesByID) Len() int { return len(t) }
func (t tablesByID) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
func (t tablesByID) Less(i, j int) bool { return t[i].ID < t[j].ID }
// Copy returns a copy of the Table.
func (t Table) Copy() Table {
result := Table{
ID: t.ID,
Label: t.Label,
Type: t.Type,
Columns: make([]Column, 0, len(t.Columns)),
Rows: make([]Row, 0, len(t.Rows)),
}
for _, column := range t.Columns {
result.Columns = append(result.Columns, column)
}
for _, row := range t.Rows {
result.Rows = append(result.Rows, row)
}
return result
}
// TableTemplate describes how to render a table for the UI.
type TableTemplate struct {
ID string `json:"id"`