-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecord.java
66 lines (60 loc) · 1.53 KB
/
Record.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* // -------------------------------------------------------------------------
/**
* A basic record containing coordinates of the record's location.
*
* @author Joshua Rush
* @author Benjamin Roble
* @version Oct 9, 2011
*/
public class Record {
// the x coordinate of this record
private int x;
// the y coordinate of this record
private int y;
/**
* Create a new Record with the specified coordinates.
* @param x the x coordinate of this record
* @param y the y coordinate of this record
*/
public Record(int x, int y) {
this.x = x;
this.y = y;
}
/**
* Get the x coordinate value for this record.
* @return the x coordinate value
*/
public int getX() {
return x;
}
/**
* Get the y coordinate value for this record.
* @return the y coordinate value
*/
public int getY() {
return y;
}
/**
* Return a String representation of this record, containing the x and y
* coordinates of the record.
* @return a string representing this record
*/
public String toString() {
String ret = x+ ","+y;
return ret;
}
/**
* Return whether or not the Object is equal to this Record. Two Records
* are equal if they have equal coordinates.
*/
public boolean equals(Object obj)
{
if(!(obj instanceof Record)) return false;
Record rec = (Record)obj;
if (rec.getX() == x && rec.getY() == y)
return true;
else
return false;
}
}