-
Notifications
You must be signed in to change notification settings - Fork 1
/
Album.java
78 lines (61 loc) · 2.23 KB
/
Album.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
import java.util.ArrayList;
import java.util.List;
public class Album {
public static final int PERCENTUAL_MINIMO_PARA_AUTO_COMPLETAR = 90;
private final Repositorio repositorio;
private final int quantItensPorPacotinho;
private List<Figurinha> figurinhasColadas; // direct addressing
public Album(Repositorio repositorio, int quantItensPorPacotinho) {
this.repositorio = repositorio;
this.quantItensPorPacotinho = quantItensPorPacotinho;
int tamanhoFisicoDaLista = getTamanho() + 1;
this.figurinhasColadas = new ArrayList<>();
// inicializa as posições com nulls, para poder acessá-las diretamente
for (int i = 0; i < tamanhoFisicoDaLista; i++) {
this.figurinhasColadas.add(null);
}
}
public void receberNovoPacotinho(Pacotinho pacotinho) {
Figurinha[] figurinhasDoPacotinho = pacotinho.getFigurinhas();
if (figurinhasDoPacotinho.length != this.quantItensPorPacotinho) {
return; // melhor ainda: lançaria uma checked exception
}
}
public Figurinha getItemColado(int posicao) {
return null; // ToDo IMPLEMENT ME!!!
}
public boolean possuiItemColado(int posicao) {
return false; // ToDo IMPLEMENT ME!!!
}
public boolean possuiItemRepetido(int posicao) {
return false; // ToDo IMPLEMENT ME!!!
}
public int getTamanho() {
return this.repositorio.getTotalFigurinhas();
}
public int getQuantItensColados() {
return 0; // ToDo IMPLEMENT ME!!!
}
public int getQuantItensFaltantes() {
return getTamanho() - getQuantItensColados();
}
public void autoCompletar() {
// ToDo IMPLEMENT ME!!!
}
// public static void main(String[] args) {
// ArrayList<Integer> meuArrayList = new ArrayList<>(200);
//
// // inicializa as posi'c~oes com nulls, para poder acess-las diretamente
// for (int i = 0; i < 200; i++) {
// meuArrayList.add(null);
// }
//
//// System.out.println(meuArrayList.get(3));
//
// meuArrayList.add(3, 300000); // insert com shift right
//
// for (int numero : meuArrayList) {
// System.out.println(numero);
// }
// }
}