Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. public int ps(){
  2. int sp = Integer.parseInt(iw.get(2)[1].trim()), c = 0;
  3. List<Integer> col1 = new ArrayList<>();
  4. List<Integer> col2 = new ArrayList<>();
  5. for (int y = 0; y < Psize; y++) {
  6. if( (y+sp) >= Psize){
  7. for (int x = 0; x < Rsize; x++) {
  8. if (tt[x][y] != null) {
  9. List templist = (List) tt[x][y];
  10. for (int j = 0; j < templist.size(); j++) {
  11. col1.add((int) templist.get(j));
  12. }
  13. }
  14. for(int y2=y+1; y2<Psize; y2++){
  15. if (tt[x][y2] != null) {
  16. List templist2 = (List) tt[x][y2];
  17. for (int i = 0; i < templist2.size(); i++){
  18. col2.add((int) templist2.get(i));
  19. }
  20. }
  21. }
  22. }
  23. for (int a = 0; a < col1.size(); a++) {
  24. for (int b = 0; b < col2.size(); b++) {
  25. c += Integer.parseInt(aa.get(col1.get(a))[col2.get(b)].trim());
  26. }
  27. }
  28. col1.clear();
  29. col2.clear();
  30. }
  31. else{
  32. for (int x = 0; x < Rsize; x++) {
  33. if (tt[x][y] != null) {
  34. List templist = (List) tt[x][y];
  35. for (int j = 0; j < templist.size(); j++) {
  36. col1.add((int) templist.get(j));
  37. }
  38. }
  39. for(int y2=y+1; y2<(y+sp); y2++){
  40. if (tt[x][y2] != null) {
  41. List templist2 = (List) tt[x][y2];
  42. for (int i = 0; i < templist2.size(); i++){
  43. col2.add((int) templist2.get(i));
  44. }
  45. }
  46. }
  47. }
  48. for (int a = 0; a < col1.size(); a++) {
  49. for (int b = 0; b < col2.size(); b++) {
  50. c += Integer.parseInt(aa.get(col1.get(a))[col2.get(b)].trim());
  51.  
  52. }
  53. }
  54. col1.clear();
  55. col2.clear();
  56. }
  57. }
  58. System.out.println("Period Spread: "+c);
  59. return c;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement