Merge type comparison into a single function call

This commit is contained in:
James Shubin
2016-01-08 04:13:42 -05:00
parent d769309cc0
commit 45ff3b6aa4
3 changed files with 27 additions and 36 deletions

29
file.go
View File

@@ -368,24 +368,21 @@ func (obj *FileType) ApplyDir() bool {
func (obj *FileType) Compare(typ Type) bool {
switch typ.(type) {
case *FileType:
return obj.compare(typ.(*FileType))
typ := typ.(*FileType)
if obj.Name != typ.Name {
return false
}
if obj.GetPath() != typ.Path {
return false
}
if obj.Content != typ.Content {
return false
}
if obj.State != typ.State {
return false
}
default:
return false
}
}
func (obj *FileType) compare(typ *FileType) bool {
if obj.Name != typ.Name {
return false
}
if obj.GetPath() != typ.Path {
return false
}
if obj.Content != typ.Content {
return false
}
if obj.State != typ.State {
return false
}
return true
}