-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathRentNode.java
97 lines (95 loc) · 2.04 KB
/
RentNode.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* RentNode.java
* the class represent a RentNode
* @author (liron mizrhai)
* @Date (1/20/2023)
*/
public class RentNode
{
private Rent _rent;
private RentNode _next;
/**
* constuctor of the class RentNode
* @parm Rent r
* @return None
*/
public RentNode (Rent r)
{
_rent = new Rent(r);
_next = null;
}// end of method RentNode
/**
* constuctor of the class RentNode
* @parm Rent r, RentNode next
* @return None
*/
public RentNode (Rent r, RentNode next)
{
this._rent = new Rent(r);
this._next = next;
}// end of method RentNode
/**
* copy constuctor of the class RentNode
* @parm RentNode other
* @return None
*/
public RentNode(RentNode other)
{
_rent = other._rent;
_next = other._next;
}// end of method RentNode
/**
* method return the rent
* @parm None
* @return Rent
*/
public Rent getRent()
{
return new Rent(_rent);
}// end of method getRent
/**
* method return the getNext
* @parm None
* @return _next
*/
public RentNode getNext()
{
return _next;
}// end of method getNext
/**
* method set the _rent to given rent
* @parm Rent r
* @return None
*/
public void setRent(Rent r)
{
_rent = new Rent(r);
}// end of method setRent
/**
* method set the _next to given RentNode
* @parm RentNode next
* @return None
*/
public void setNext(RentNode next)
{
_next = next;
}// end of method setNext
/**
* method return RentNode at given index
* @parm int index
* @return RentNode
*/
public RentNode get(int index)
{
if(index < 0)
{
throw new IndexOutOfBoundsException();
}
RentNode temp = new RentNode(_rent);
for(int i = 0; i < index; i++)
{
temp = temp.getNext();
}
return temp;
}// end of method get
}// end of class RentNode