-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBingoCardSet.java
72 lines (43 loc) · 1.58 KB
/
BingoCardSet.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
import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
public class BingoCardSet {
//private static ArrayList<ArrayList<Integer>> card;
private static Collection<BingoCard> bingo_cards;
private static Collection<ArrayList<Integer>> goals_per_card;
public BingoCardSet(){
bingo_cards = new LinkedList<>();
goals_per_card = new LinkedList<>();
}
// read in the https://stackoverflow.com/questions/4769976/reading-2-d-array-from-a-file#4770008
//Einlesen aller schon eingetragenen Karten aus extra Datei
public void readFromFile(String file) throws FileNotFoundException {
BingoCard card = new BingoCard();
Scanner input = new Scanner(new File(file));
while (input.hasNextLine()) {
String tmp = input.nextLine();
if (tmp.equals(".")) {
bingo_cards.add(card);
card.convertCard();
card = new BingoCard();
} else {
Scanner colReader = new Scanner(tmp);
ArrayList col = new ArrayList();
while (colReader.hasNextInt()) {
col.add(colReader.nextInt());
}
card.addColumn(col);
}
}
}
public void printAllCards(){
for (BingoCard c : bingo_cards) {
System.out.print("neues Array");
c.toCard();
}
System.out.println("size liste" + bingo_cards.size());
}
public Collection<ArrayList<Integer>> findAllGoals(){
return null;
}
}