Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.18 KB | None | 0 0
  1. public int fLoad(){
  2. int n=0, c=0, fLoad;
  3. while( Psize-Integer.parseInt(iw.get(4)[2].trim())+n < Psize){
  4. for(int a=0; a<Rsize; a++){
  5. List tm = (List)tt[a][Psize-Integer.parseInt(iw.get(4)[2].trim())+n];
  6. if(tm==null){
  7. }
  8. else{
  9. for (int l = 0; l < tm.size(); l++) {
  10. if(bb.get((int)tm.get(l)).length-1 >= LE[Integer.parseInt(iw.get(4)[1].trim())-1][1]){
  11. c+=1;
  12. }
  13. }
  14. }
  15. }
  16. n++;
  17. }
  18. fLoad=Integer.parseInt(iw.get(4)[3].trim())*c;
  19. System.out.println("Front Load: "+fLoad);
  20. return fLoad;
  21. }
  22.  
  23. public int md(){
  24. int c=0, md;
  25. for(int x = 0; x < Rsize ;x++){
  26. for(int y = 0; y < Psize ;y++){
  27. List templist = (List)tt[x][y];
  28. if (templist==null){
  29. }
  30. else{
  31. if(templist.size()>1){
  32. for(int i=1;i<templist.size();i++){
  33. for(int j=0;j<i;j++){
  34. if(Integer.parseInt(bb.get((int)templist.get(i))[0].trim())!= Integer.parseInt(bb.get((int)templist.get(j))[0].trim())){
  35. if(j==i-1){
  36. c+=1;
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
  44. }
  45. md=Integer.parseInt(iw.get(3)[1].trim())*c;
  46. System.out.println("Mixed Durations: "+md);
  47. return md;
  48. }
  49.  
  50. public int tir(){
  51. int c=0, tir;
  52. String[] periodDate = new String[p.size()];
  53. for (int i = 0; i < p.size(); i++) {
  54. periodDate[i] = p.get(i)[0].trim();
  55. }
  56. for (int y = 0; y < Psize; y++) {
  57. List<Integer> col1 = new ArrayList<>();
  58. List<Integer> col2 = new ArrayList<>();
  59. if (y != Psize-1) {
  60. if (periodDate[y].equals(periodDate[y + 1])) {
  61. for (int x = 0; x < Rsize; x++) {
  62. if (tt[x][y] != null) {
  63. List templist = (List) tt[x][y];
  64. for (int j = 0; j < templist.size(); j++) {
  65. col1.add((int) templist.get(j));
  66. }
  67. }
  68. if (tt[x][y + 1] != null) {
  69. List templist2 = (List) tt[x][y + 1];
  70. for (int j = 0; j < templist2.size(); j++) {
  71. col2.add((int) templist2.get(j));
  72. }
  73. }
  74. }
  75. }
  76. }
  77. for (int i = 0; i < col1.size(); i++) {
  78. for (int j = 0; j < col2.size(); j++) {
  79. c += Integer.parseInt(aa.get(col1.get(i))[col2.get(j)].trim());
  80. }
  81. }
  82. }
  83. tir=Integer.parseInt(iw.get(0)[1].trim())*c;
  84. System.out.println("Two in a Row: "+tir);
  85. return tir;
  86. }
  87.  
  88. public int tid(){
  89. int c=0, n=0, total, tid;
  90. String[] periodDate = new String[p.size()];
  91. for (int i = 0; i < p.size(); i++) {
  92. periodDate[i] = p.get(i)[0].trim();
  93. }
  94. for (int y = 0; y < Psize; y++) {
  95. List<Integer> col1 = new ArrayList<>();
  96. List<Integer> col2 = new ArrayList<>();
  97. List<Integer> col3 = new ArrayList<>();
  98. if (y <= Psize - 4) {
  99. if (periodDate[y].equals(periodDate[y + 2])) {
  100. for (int x = 0; x < Rsize; x++) {
  101. if (tt[x][y] != null) {
  102. List templist = (List) tt[x][y];
  103. for (int j = 0; j < templist.size(); j++) {
  104. col1.add((int) templist.get(j));
  105. }
  106. }
  107. if (tt[x][y+2] != null) {
  108. List templist2 = (List) tt[x][y + 2];
  109. for (int j = 0; j < templist2.size(); j++) {
  110. col2.add((int) templist2.get(j));
  111. }
  112. }
  113. }
  114. for (int i = 0; i < col1.size(); i++) {
  115. for (int j = 0; j < col2.size(); j++) {
  116. c += Integer.parseInt(aa.get(col1.get(i))[col2.get(j)].trim());
  117. }
  118. }
  119. }
  120. if (periodDate[y].equals(periodDate[y + 3])) {
  121. for (int x = 0; x < Rsize; x++) {
  122. if (tt[x][y+3] != null) {
  123. List templist3 = (List) tt[x][y + 3];
  124. for (int j = 0; j < templist3.size(); j++) {
  125. col3.add((int) templist3.get(j));
  126. }
  127. }
  128. }
  129. for (int i = 0; i < col1.size(); i++) {
  130. for (int j = 0; j < col3.size(); j++) {
  131. n += Integer.parseInt(aa.get(col1.get(i))[col3.get(j)].trim());
  132. }
  133. }
  134. }
  135. }
  136. }
  137. total = c + n;
  138. tid = total * Integer.parseInt(iw.get(1)[1].trim());
  139. System.out.println("Two in a Day: " +tid);
  140. return tid;
  141. }
  142.  
  143. public int ps(){
  144. int sp = Integer.parseInt(iw.get(2)[1].trim()), c = 0;
  145. List<Integer> col1 = new ArrayList<>();
  146. List<Integer> col2 = new ArrayList<>();
  147. for (int y = 0; y < Psize; y++) {
  148. if( (y+sp) >= Psize){
  149. for (int x = 0; x < Rsize; x++) {
  150. if (tt[x][y] != null) {
  151. List templist = (List) tt[x][y];
  152. for (int j = 0; j < templist.size(); j++) {
  153. col1.add((int) templist.get(j));
  154. }
  155. }
  156. for(int y2=y+1; y2<Psize; y2++){
  157. if (tt[x][y2] != null) {
  158. List templist2 = (List) tt[x][y2];
  159. for (int i = 0; i < templist2.size(); i++){
  160. col2.add((int) templist2.get(i));
  161. }
  162. }
  163. }
  164. }
  165. for (int a = 0; a < col1.size(); a++) {
  166. for (int b = 0; b < col2.size(); b++) {
  167. c += Integer.parseInt(aa.get(col1.get(a))[col2.get(b)].trim());
  168. }
  169. }
  170. col1.clear();
  171. col2.clear();
  172. }
  173. else{
  174. for (int x = 0; x < Rsize; x++) {
  175. if (tt[x][y] != null) {
  176. List templist = (List) tt[x][y];
  177. for (int j = 0; j < templist.size(); j++) {
  178. col1.add((int) templist.get(j));
  179. }
  180. }
  181. for(int y2=y+1; y2<(y+sp); y2++){
  182. if (tt[x][y2] != null) {
  183. List templist2 = (List) tt[x][y2];
  184. for (int i = 0; i < templist2.size(); i++){
  185. col2.add((int) templist2.get(i));
  186. }
  187. }
  188. }
  189. }
  190. for (int a = 0; a < col1.size(); a++) {
  191. for (int b = 0; b < col2.size(); b++) {
  192. c += Integer.parseInt(aa.get(col1.get(a))[col2.get(b)].trim());
  193.  
  194. }
  195. }
  196. col1.clear();
  197. col2.clear();
  198. }
  199. }
  200. System.out.println("Period Spread: "+c);
  201. return c;
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement