Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package timetablingsystem;
  6.  
  7. import java.util.ArrayList;
  8. import java.util.List;
  9.  
  10. /**
  11. *
  12. * @author ASUS
  13. */
  14. public class FitnessValue {
  15.  
  16. Object[][] tt;
  17. int Fitness;
  18. int Rsize;
  19. int Psize;
  20. int dataset;
  21. int accumulation = 0;
  22. Object[] CM;
  23. List<String[]> iw;
  24. List<String[]> p;
  25. List<String[]> aa;
  26.  
  27. public FitnessValue(Object[][] tt, Object[] CM, List<String[]> iw, List<String[]> p, int Psize, int Rsize, List<String[]> aa){
  28. this.tt = tt;
  29. this.CM = CM;
  30. this.iw = iw;
  31. this.p = p;
  32. this.Psize = Psize;
  33. this.Rsize = Rsize;
  34. this.aa = aa;
  35. }
  36.  
  37. public void PeriodSpread(){
  38.  
  39. int examnumber = 0;
  40. int spread = Integer.parseInt(iw.get(2)[1].trim());
  41.  
  42. for(int y = 0; y < Psize; y++){
  43. List<Integer> col1 = new ArrayList<>();
  44. List<Integer> col2 = new ArrayList<>();
  45.  
  46. if(y + spread >= Psize){
  47.  
  48. }
  49. else{
  50. for(int x = 0; x < Rsize; x++){
  51. if(tt[x][y] != null){
  52. List templist = (List) tt[x][y];
  53.  
  54. for(int j = 0; j < templist.size(); j++){
  55. if(templist.get(j) != null){
  56.  
  57. examnumber = (int) templist.get(j);
  58. col1.add(examnumber);
  59.  
  60. }
  61. }
  62. }
  63. if(tt[x][y+spread] != null){
  64.  
  65. List templist2 = (List) tt[x][y+spread];
  66.  
  67. for(int j = 0; j < templist2.size(); j++){
  68. if(templist2.get(j) != null){
  69.  
  70. examnumber = (int) templist2.get(j);
  71. col2.add(examnumber);
  72. }
  73.  
  74.  
  75.  
  76. }
  77.  
  78. }
  79. }
  80.  
  81. }
  82.  
  83. for(int i = 0; i < col1.size(); i++){
  84. for(int j = 0; j < col2.size(); j++){
  85. accumulation += Integer.parseInt(aa.get(col1.get(i))[col2.get(j)].trim());
  86. }
  87. }
  88.  
  89. }
  90.  
  91. System.out.print("Accumulation = " +accumulation);
  92. }
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement