Created animediff package

This commit is contained in:
2018-03-09 05:12:22 +01:00
parent 3ac77b889b
commit 1910b3c2d8
8 changed files with 93 additions and 59 deletions

View File

@ -0,0 +1,22 @@
package animediff
// CanonicalTitle describes differing titles.
type CanonicalTitle struct {
TitleA string
TitleB string
}
// String returns the description.
func (diff *CanonicalTitle) String() string {
return "Canonical titles are different"
}
// DetailsA shows the details for the first anime.
func (diff *CanonicalTitle) DetailsA() string {
return diff.TitleA
}
// DetailsB shows the details for the second anime.
func (diff *CanonicalTitle) DetailsB() string {
return diff.TitleB
}

24
utils/animediff/Genres.go Normal file
View File

@ -0,0 +1,24 @@
package animediff
import "strings"
// Genres describes differing genres.
type Genres struct {
GenresA []string
GenresB []string
}
// String returns the description.
func (diff *Genres) String() string {
return "Genres are different"
}
// DetailsA shows the details for the first anime.
func (diff *Genres) DetailsA() string {
return strings.Join(diff.GenresA, ", ")
}
// DetailsB shows the details for the second anime.
func (diff *Genres) DetailsB() string {
return strings.Join(diff.GenresB, ", ")
}

View File

@ -0,0 +1,8 @@
package animediff
// Difference describes a difference between two anime.
type Difference interface {
String() string
DetailsA() string
DetailsB() string
}

View File

@ -0,0 +1,22 @@
package animediff
// JapaneseTitle describes differing Japanese titles.
type JapaneseTitle struct {
TitleA string
TitleB string
}
// String returns the description.
func (diff *JapaneseTitle) String() string {
return "Japanese titles are different"
}
// DetailsA shows the details for the first anime.
func (diff *JapaneseTitle) DetailsA() string {
return diff.TitleA
}
// DetailsB shows the details for the second anime.
func (diff *JapaneseTitle) DetailsB() string {
return diff.TitleB
}