-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathType.java
More file actions
21 lines (21 loc) · 836 Bytes
/
Copy pathPathType.java
File metadata and controls
21 lines (21 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* ============================================================================================
* enum which defines the type of paths in A1
* NAME: JANHAV KHANNA
* YOUR UPI: JKHA639
* DATE: 20/05/21
* DESCRIPTION: This is the pathtype class which handles the paths that each shape can take.
* ============================================================================================
*/
import java.util.*;
enum PathType { BOUNCE, FALL;
private static final Random rand = new Random();
private static final int SIZE = values().length;
public static final PathType getPathType(int index) { return values()[index]; }
public PathType next() {
return values()[(ordinal() + 1) % values().length];
}
public static PathType getRandomPathType() {
return values()[rand.nextInt(SIZE)];
}
}