8caf0ac3aa
Added framework to generate DOT and png files of character map chart from data folder. Added all figures in the 1-2 chapters. Added font file SimSum for render chart
25 lines
685 B
Go
25 lines
685 B
Go
package relationship
|
|
|
|
import "fmt"
|
|
|
|
type Relationship struct {
|
|
Src string `yaml:"source"`
|
|
Dst string `yaml:"destination"`
|
|
Description string `yaml:"description"`
|
|
Bidirection bool `yaml:"bidirection"`
|
|
}
|
|
|
|
func (r Relationship) IsSame(other Relationship) bool {
|
|
if r.Bidirection {
|
|
if r.Description != other.Description {
|
|
return false
|
|
}
|
|
return (r.Src == other.Src && r.Dst == other.Dst) || (r.Src == other.Dst && r.Dst == other.Src)
|
|
}
|
|
return r.Src == other.Src && r.Dst == other.Dst && r.Description == other.Description
|
|
}
|
|
|
|
func (r Relationship) GetKey() (string, string) {
|
|
return fmt.Sprintf("%s-%s", r.Src, r.Dst), fmt.Sprintf("%s-%s", r.Dst, r.Src)
|
|
}
|