-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCircuit.java
More file actions
43 lines (36 loc) · 900 Bytes
/
Circuit.java
File metadata and controls
43 lines (36 loc) · 900 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prop;
import java.util.ArrayList;
/**
*
* @author aula
*/
public class Circuit {
private final ArrayList<String> llocs;
public Circuit() {
llocs = new ArrayList<>();
}
/**
* @pre --
* @return true si l'objecte actual es buit
*/
public boolean esBuit(){
return(llocs.isEmpty());
}
/**
*
* @param r1
* @pre --
* @post s'han concatenat les llistes, el circuit r1 darrera de l'objecte actual
*/
public void concatenarRuta(Circuit r1){
while(!r1.esBuit()){
llocs.add(r1.llocs.get(0));
r1.llocs.remove(0);
}
}
}