Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,55 @@
/* NetRexx */
options replace format comments java crossref savelog symbols nobinary
class RCSortStability
method main(args = String[]) public constant
cityList = [String "UK London", "US New York", "US Birmingham", "UK Birmingham"]
cn = String[cityList.length]
say
say "Before sort:"
System.arraycopy(cityList, 0, cn, 0, cityList.length)
loop city = 0 to cn.length - 1
say cn[city]
end city
cCompNm = Comparator CityComparator()
Arrays.sort(cn, cCompNm)
say
say "After sort on city:"
loop city = 0 to cn.length - 1
say cn[city]
end city
say
say "Before sort:"
System.arraycopy(cityList, 0, cn, 0, cityList.length)
loop city = 0 to cn.length - 1
say cn[city]
end city
cCompCtry = Comparator CountryComparator()
Arrays.sort(cn, cCompCtry)
say
say "After sort on country:"
loop city = 0 to cn.length - 1
say cn[city]
end city
say
return
class RCSortStability.CityComparator implements Comparator
method compare(lft = Object, rgt = Object) public binary returns int
return (String lft).substring(4).compareTo((String rgt).substring(4))
class RCSortStability.CountryComparator implements Comparator
method compare(lft = Object, rgt = Object) public binary returns int
return (String lft).substring(0, 2).compareTo((String rgt).substring(0, 2))