-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPair.java
More file actions
33 lines (27 loc) · 737 Bytes
/
Copy pathPair.java
File metadata and controls
33 lines (27 loc) · 737 Bytes
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
public class Pair implements Comparable<Pair>{
private String word;
private int priority;
public Pair(String word, int priority){
this.word = word;
this.priority = priority;
}
@Override
public int compareTo(Pair p){
int comparedPriority = p.priority;
if(this.priority > comparedPriority) return -1;
else if (this.priority == comparedPriority) return 0;
else return 1;
}
public String getWord(){
return this.word;
}
public int getPriority(){
return this.priority;
}
public void setPriority(int priority){
this.priority = priority;
}
public void setWord(String word){
this.word = word;
}
}