-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRound_Robin_Arbiter.java
65 lines (42 loc) · 1.49 KB
/
Round_Robin_Arbiter.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
// ajouter par amine
// mettre a jour pour le RT
package Router;
import java.util.ArrayList;
public class Round_Robin_Arbiter implements Arbiter{
public int Laste_Buffer_served;
//pour arbitrer et supprimer le premier de le list Port_List_for_Arbiter
public int Req_Arbitration(ArrayList<Integer> List_port) {
if(!List_port.isEmpty()){
int LS=List_port.get(0);
//List_port.clear();
return LS ;}
else {System.out.println("Liste port est vide");
}
return -1;
}
/*****************************changéé***************************************/
public int Selector(ArrayList<Integer> List_port) {//pour selection
//cettte méthode sert a pré-selectionner un candidat de List_Port_for_Arbiter
if(!List_port.isEmpty()){
int LS=List_port.get(0);
return LS ;
}
else {System.out.println("Liste port est vide");
}
return -1;
}
/********************************************************************/
public int Req_Arbitration(ArrayList<Integer> List_port,int first_data) {
//pour arbitré et supprimer qui est le id (first_data) de le list
if(!List_port.isEmpty()){
System.out.println("in arbitre 2 == "+first_data);
int LS=List_port.get(first_data);
System.out.println("le port de sortier : "+LS);
List_port.remove(first_data);
System.out.println("size is : "+List_port.size());
return LS ;}
else {System.out.println("Liste port est vide");
}
return -1;
}
}