-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathAnnotation.java
More file actions
63 lines (55 loc) · 1.26 KB
/
Annotation.java
File metadata and controls
63 lines (55 loc) · 1.26 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
/**
* class Annotation - describes an annotation, contains a type and a location
*
* @author Dakota Williams
*/
public class Annotation implements Undoable, Comparable {
private int type;
private double location;
/**
* Constructor - creates a new Annotation
*
* @param type a number that represents the type of annotation
* @param loc the location of the annotation
*/
public Annotation(int type, double loc) {
this.type = type;
this.location = loc;
}
/**
* Copy Constructor - creates a copy of a given object
*
* @param anno the object to copy
* @return a copy of anno
*/
public Annotation(Annotation anno) {
this(anno.getType(), anno.getLoc());
}
/**
* getLoc - returns the location of this annotation
*
* @return the location of this annotation
*/
public double getLoc() {
return location;
}
/**
* getType - returns the type of this annotation
*
* @return the type of this annotation
*/
public int getType() {
return type;
}
/**
* toString - string representation of the data
*
* @return a string of the form "[type] [location]"
*/
public String toString() {
return (double)type + " " + location;
}
public int compareTo(Object other) {
return Double.compare(location, ((Annotation)other).location);
}
}