-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWordEntry.java
More file actions
executable file
·46 lines (33 loc) · 960 Bytes
/
WordEntry.java
File metadata and controls
executable file
·46 lines (33 loc) · 960 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
34
35
36
37
38
39
40
41
42
43
44
45
46
public class WordEntry {
private String ofThisWord;
private MyLinkedList<Position> positions;
public WordEntry(String word) {
// TODO Auto-generated constructor stub
this.ofThisWord=word;
positions= new MyLinkedList<Position>();
}
public WordEntry(String word,MyLinkedList<Position> l)
{
this.ofThisWord=word;
this.positions=l;
}
public void addPosition(Position position)
{
positions.add(position);
}
public void addPositions(MyLinkedList<Position> positions) throws LinkedListOutofBoundsException
{
//adding an entire list of new positions to be added
Node<Position> tailOfToBeAdded=positions.get(positions.getSize()-1);
tailOfToBeAdded.setNext(this.positions.head);
this.positions.head=positions.head;
}
public MyLinkedList<Position> getAllPositionsForThisWord()
{
return this.positions;
}
public String getWord()
{
return this.ofThisWord;
}
}