feat(aa): rule interface: replace less & equal by the compare method.
- set a new alphabet order to sort AARE based string. - unify compare function for all rules - handle some special sort order, eg: base include
This commit is contained in:
parent
747292e954
commit
4cbacc186c
22 changed files with 250 additions and 399 deletions
|
|
@ -19,14 +19,9 @@ func (r *Hat) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *Hat) Less(other any) bool {
|
||||
func (r *Hat) Compare(other Rule) int {
|
||||
o, _ := other.(*Hat)
|
||||
return p.Name < o.Name
|
||||
}
|
||||
|
||||
func (p *Hat) Equals(other any) bool {
|
||||
o, _ := other.(*Hat)
|
||||
return p.Name == o.Name
|
||||
return compare(r.Name, o.Name)
|
||||
}
|
||||
|
||||
func (p *Hat) String() string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue