Separated into model and application & receiveValues() & Array
This commit is contained in:
parent
fd37c39e11
commit
91b37cc7e1
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package application;
|
package model;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
37
src/model/Graph.java
Normal file
37
src/model/Graph.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
src/model/GraphException.java
Normal file
11
src/model/GraphException.java
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user