github.com/daixiang0/gci@v0.13.4/pkg/specificity/match.go (about)

     1  package specificity
     2  
     3  import "fmt"
     4  
     5  type Match struct {
     6  	Length int
     7  }
     8  
     9  func (m Match) IsMoreSpecific(than MatchSpecificity) bool {
    10  	otherMatch, isMatch := than.(Match)
    11  	return isMoreSpecific(m, than) || (isMatch && m.Length > otherMatch.Length)
    12  }
    13  
    14  func (m Match) Equal(to MatchSpecificity) bool {
    15  	return equalSpecificity(m, to)
    16  }
    17  
    18  func (m Match) class() specificityClass {
    19  	return MatchClass
    20  }
    21  
    22  func (m Match) String() string {
    23  	return fmt.Sprintf("Match(length: %d)", m.Length)
    24  }