本文整理汇总了Golang中github.com/AntoineAugusti/moduluschecking/models.SortCodeData.IsException方法的典型用法代码示例。如果您正苦于以下问题:Golang SortCodeData.IsException方法的具体用法?Golang SortCodeData.IsException怎么用?Golang SortCodeData.IsException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/AntoineAugusti/moduluschecking/models.SortCodeData
的用法示例。
在下文中一共展示了SortCodeData.IsException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: WeightsForException2Or9
// Get weights to use for a bank account following the exception 2 or 9.
func WeightsForException2Or9(b m.BankAccount, sc m.SortCodeData) (weights []int) {
if !(sc.IsException(2) || sc.IsException(9)) {
panic("Expected exception 2 or exception 9 sort code")
}
a := b.NumberAtPosition("a")
g := b.NumberAtPosition("g")
// Default weights
weights = sc.Weights
switch {
case a != 0 && g != 9:
weights = []int{
0, 0, 1, 2, 5, 3,
6, 4, 8, 7, 10, 9, 3, 1,
}
case a != 0 && g == 9:
weights = []int{
0, 0, 0, 0, 0, 0,
0, 0, 8, 7, 10, 9, 3, 1,
}
}
return
}
示例2: FollowsException3
// Check if we follow the criteria of the exception 3
func FollowsException3(b m.BankAccount, scData m.SortCodeData) bool {
c := b.NumberAtPosition("c")
hasNextAnd3 := scData.HasNext() && scData.Next.IsException(3)
return (scData.IsException(3) || hasNextAnd3) && (c == 6 || c == 9)
}
示例3: Handles
// Determine if the checker is able to validate the bank account
func (e Exception10Checker) Handles(account m.BankAccount, sc m.SortCodeData, attempt int) bool {
if !sc.IsException(10) {
return false
}
// if ab = 09 or ab = 99 and g = 9
a := account.NumberAtPosition("a")
b := account.NumberAtPosition("b")
g := account.NumberAtPosition("g")
return (a == 0 || a == 9) && b == 9 && g == 9
}
示例4: Handles
// Determine if the checker is able to validate the bank account
func (e Exception6Checker) Handles(b m.BankAccount, sc m.SortCodeData, attempt int) bool {
return sc.IsException(6)
}
示例5: Handles
// Determine if the checker is able to validate the bank account
func (e Exception7Checker) Handles(account m.BankAccount, sc m.SortCodeData, attempt int) bool {
// If g=9
g := account.NumberAtPosition("g")
return sc.IsException(7) && g == 9
}