package system import "git.tebibyte.media/tomo/tomo" type attrHierarchy [T tomo.Attr] struct { style T user T userExists bool } func (this *attrHierarchy[T]) SetStyle (style T) (different bool) { styleEquals := this.style.Equals(style) this.style = style return !styleEquals && !this.userExists } func (this *attrHierarchy[T]) SetUser (user T) (different bool) { userEquals := this.user.Equals(user) this.user = user this.userExists = true return !userEquals } func (this *attrHierarchy[T]) Set (attr T, user bool) (different bool) { if user { return this.SetUser(attr) } else { return this.SetStyle(attr) } } func (this *attrHierarchy[T]) Value () T { if this.userExists { return this.user } else { return this.style } }