-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExchangeList.java
More file actions
38 lines (28 loc) · 762 Bytes
/
Copy pathExchangeList.java
File metadata and controls
38 lines (28 loc) · 762 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
import java.io.*;
import java.util.*;
public class ExchangeList{
private MySet<Exchange> exchange_list;
public ExchangeList(){
this.exchange_list = new MySet<Exchange>();
}
public int size(){
return this.exchange_list.size;
}
public void printList(){
int i;
for(i=0;i < (this.exchange_list.size-1);i++){
System.out.print(this.exchange_list.findIthNode(i).number() + ", ");
}
System.out.println(this.exchange_list.findIthNode(i).number());
}
public Exchange findChild(int i){
return this.exchange_list.findIthNode(i);
}
public void add(int e, Exchange p){
Exchange exchange = new Exchange(e,p);
this.exchange_list.Insert(exchange,e);
}
public void addExchange(Exchange e){
this.exchange_list.Insert(e,e.number());
}
}