-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInnings.java
47 lines (47 loc) · 917 Bytes
/
Innings.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
class Innings {
//private int runs,balls,wickets,extras;
private int[] Stats=new int[4];
private int[] BatOrder=new int[11];
private int[] BowlOrder=new int[11];
public void Modify(int[] r) {
switch(r[0]) {
case 1: {
for(int j=1;j<r.length;j++)
Stats[j-1]+=r[j];
}
break;
case 2: {
for(int j=1;j<r.length;j++)
Stats[j-1]-=r[j];
}
break;
case 3: {
for(int j=1;j<r.length;j++) {
if(r[j]!=-1)
Stats[j-1]=r[j];
}
}
break;
}
}
public void ModifyBatOrder(int n) {
int i;
for(i=0;BatOrder[i]!=0;i++);
BatOrder[i]=n;
}
public void ModifyBowlOrder(int n) {
int i;
for(i=0;BowlOrder[i]!=0;i++);
BowlOrder[i]=n;
}
public int[] GetBatOrder(int n) {
return BatOrder;
}
public int[] GetBowlOrder(int n) {
return BowlOrder;
}
public int[] Get() {
return Stats;
}
}