/Users/johnr/Dropbox/johnrayworth.info/largeFilesOutsideJSR/__IB-Other/Other/IA-Solutions-2019/Haruto/Product/IA.ver2/src/ia/ver2/StatSort.java
 1 /*
 2  * To change this license header, choose License Headers in Project Properties.
 3  * To change this template file, choose Tools | Templates
 4  * and open the template in the editor.
 5  */
 6 package ia.ver2;
 7 
 8 /**
 9  *
10  * @author 19196
11  */
12 public class StatSort {
13     public void sortForStat(Stats [] stat){
14         for(int pass = 0; pass < stat.length - 1; pass++){
15             for(int i = 0; i < stat.length - 1; i++){
16                 if((stat[i].getName()).compareTo(stat[i+1].getName()) < 0){
17                     Stats temp = stat[i]; 
18                     stat[i] = stat[i+1]; 
19                     stat[i+1] = temp; 
20                 }
21             }
22         }
23     }
24     public void sortRank(Rank [] subStat, int nameItem){
25         for(int pass1 = 0; pass1 < nameItem - 2; pass1++){
26             for(int j = 0; j < nameItem - 2; j++){
27                 //System.out.println("Inside rank");
28                 if(subStat[j].getRankNum() > subStat[j+1].getRankNum()){
29                     Rank temp1 = subStat[j]; 
30                     subStat[j] = subStat[j+1]; 
31                     subStat[j+1] = temp1; 
32                 }
33             }
34         }
35     }
36          
37 }
38