-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.java
More file actions
84 lines (76 loc) · 1.64 KB
/
Event.java
File metadata and controls
84 lines (76 loc) · 1.64 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import java.util.ArrayList;
public class Event
{
private int id;
private int distance;
private ArrayList<Ticket> tickets;
/**
* Constructor for a default event
*/
Event()
{
id = 0;
distance = -1;
}
/**
* Constructor for an event with a given id and a given number of tickets
*
* @param id The id given to the event
* @param i The number of tickets to be created for this event
*/
Event(int id, int i)
{
this.id = id;
distance = -1;
generateTickets(i);
}
/**
* Generates tickets for this event
*
* @param i Number of tickets to be created
*/
private void generateTickets(int i)
{
tickets = new ArrayList<>();
for(int j = 0; j < i; j++)
{
tickets.add(new Ticket(j + 1));
}
}
/**
* Returns id of the event
*
* @return Id of the event
*/
public int getId()
{
return id;
}
/**
* Returns distance of the event from searched location
*
* @return Distance of the event from searched location
*/
public int getDistance()
{
return distance;
}
/**
* Returns the ticket ArrayList for this event
*
* @return ArrayList of tickets for this event
*/
public ArrayList<Ticket> getTickets()
{
return tickets;
}
/**
* Sets the distance from searched location for this event
*
* @param distance Distance from searched location for this event
*/
public void setDistance(int distance)
{
this.distance = distance;
}
}