Using safer function Max
parent
8f3452988e
commit
dfb1aa070a
|
@ -18,15 +18,17 @@ func (mip *AbstractMulticast) AddUniqueAndSort(hier int64) {
|
||||||
mip.HierarchyArray = append(mip.HierarchyArray, hier)
|
mip.HierarchyArray = append(mip.HierarchyArray, hier)
|
||||||
sort.Slice(mip.HierarchyArray, func(i, j int) bool { return mip.HierarchyArray[i] < mip.HierarchyArray[j] })
|
sort.Slice(mip.HierarchyArray, func(i, j int) bool { return mip.HierarchyArray[i] < mip.HierarchyArray[j] })
|
||||||
log.Println("Here the numbers known:", mip.HierarchyArray)
|
log.Println("Here the numbers known:", mip.HierarchyArray)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mip *AbstractMulticast) IsAlpha(hier int64) bool {
|
func (mip *AbstractMulticast) IsAlpha(hier int64) bool {
|
||||||
|
|
||||||
log.Println("Element 0 is :", mip.HierarchyArray[0])
|
alpha := slices.Max(mip.HierarchyArray)
|
||||||
|
log.Println("Maximum element is :", alpha)
|
||||||
|
|
||||||
return mip.HierarchyArray[0] == hier
|
return alpha == hier
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue