Separated into model and application & receiveValues() & Array

This commit is contained in:
FUH22860 2022-05-31 12:23:51 +02:00
parent fd37c39e11
commit 91b37cc7e1
4 changed files with 49 additions and 17 deletions

View File

@ -1,16 +0,0 @@
package application;
import java.util.ArrayList;
public class Graph {
private ArrayList<ArrayList<Graph>> values;
public Graph() {
values = new ArrayList<ArrayList<Graph>>();
}
public boolean receiveValues() {
return true;
}
}

View File

@ -1,4 +1,4 @@
package application;
package model;
import java.io.File;

37
src/model/Graph.java Normal file
View File

@ -0,0 +1,37 @@
package model;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class Graph {
private ArrayList<Graph> values;
public Graph() {
values = new ArrayList<Graph>();
}
public boolean receiveValues() throws GraphException {
try (BufferedReader br = new BufferedReader(new FileReader(""))) { // filePath von application.RootBorderPane.importCSV()
String zeile;
String[] zeilenTeile;
String sep = ";"; // erwartetes Trennzeichen in der csv-Datei
zeile = br.readLine(); // wenn keine Zeile gefunden, dann return null
while (zeile != null) {
zeilenTeile = zeile.trim().split(sep);
}
} catch (FileNotFoundException e) {
throw new GraphException("Datei-Fehler bei receiveValues(): " + e.getMessage());
} catch (IOException e) {
throw new GraphException("Datei-Fehler bei receiveValues(): " + e.getMessage());
}
return false;
}
}

View File

@ -0,0 +1,11 @@
package model;
public class GraphException extends Exception{
private static final long serialVersionUID = 2022_05_31__12_16L;
public GraphException(String message) {
super(message);
}
}