diff --git a/.gitignore b/.gitignore index 5d73d26..8c629ba 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ bin/application/logik/Logik.class *.classpath .classpath .project -.settings/ \ No newline at end of file +.settings/ diff --git a/README.md b/README.md deleted file mode 100644 index c15eb08..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Die Gefährten des String - - - -[![Build Status](https://travis-ci.org/ProPra16/programmierpraktikum-abschlussprojekt-the-fellowship-of-the-string.svg?branch=master)](https://travis-ci.org/ProPra16/programmierpraktikum-abschlussprojekt-the-fellowship-of-the-string) diff --git a/src/FileHandling/Code.java b/src/FileHandling/Code.java index 19885cb..16604ca 100644 --- a/src/FileHandling/Code.java +++ b/src/FileHandling/Code.java @@ -1,7 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package FileHandling; - import vk.core.api.CompilationUnit; +import vk.core.api.CompileError; import vk.core.api.CompilerFactory; import vk.core.api.CompilerResult; @@ -18,30 +31,29 @@ public class Code { private String className; private CompilationUnit compilationUnitCode; private boolean compilable; - - - public Code(String className,String code){ - this.code=code; - this.className=className; - this.compilationUnitCode = new CompilationUnit(className, code, false ); + + public Code(String className, String code) { + this.code = code; + this.className = className; + this.compilationUnitCode = new CompilationUnit(className, code, false); this.compilable = testingCompilationUnit(); } - - public boolean testingCompilationUnit(){ + + public boolean testingCompilationUnit() { JavaStringCompiler compiler = CompilerFactory.getCompiler(compilationUnitCode); compiler.compileAndRunTests(); CompilerResult result = compiler.getCompilerResult(); - - if(result.hasCompileErrors() == true) compilable = true; - - else{ - TestHelpers.getErrorMessages(compiler, result); + + if (result.hasCompileErrors() == true) { + System.out.println(TestHelpers.getErrorMessages(compiler, result)); compilable = false; } - + + else if (result.hasCompileErrors() == false) + compilable = true; + return compilable; } - - + } diff --git a/src/FileHandling/CodeList.java b/src/FileHandling/CodeList.java index 227a6de..ad79b38 100644 --- a/src/FileHandling/CodeList.java +++ b/src/FileHandling/CodeList.java @@ -1,28 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package FileHandling; import java.util.ArrayList; -public class CodeList extends ArrayList{ - +public class CodeList extends ArrayList { + /** * */ private static final long serialVersionUID = 1L; private boolean compilable; - - public CodeList(){ + public CodeList() { super(); } - - public boolean compilable(){ - - Code[] codeArray = (Code[]) this.toArray(); - - for(int i = 0; i< codeArray.length; i++){ - compilable = codeArray[i].testingCompilationUnit(); - - if(compilable == false) return false; + + public boolean compilable() { + + Object[] codeArray = this.toArray(); + + for (int i = 0; i < codeArray.length; i++) { + compilable = ((Code) codeArray[i]).testingCompilationUnit(); + + if (compilable == false) + return false; } return true; } diff --git a/src/FileHandling/Exercise.java b/src/FileHandling/Exercise.java index 401f185..ac2daad 100644 --- a/src/FileHandling/Exercise.java +++ b/src/FileHandling/Exercise.java @@ -1,33 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package FileHandling; public class Exercise { - + private String description; private CodeList klassen; private TestList tests; - private boolean baby,timer; - - - public Exercise(String description,CodeList klassen,TestList tests,boolean baby,boolean timer){ - this.description=description; - this.klassen=klassen; - this.tests=tests; - this.baby=baby; - this.timer=timer; + private boolean baby, timer; + + public Exercise(String description, CodeList klassen, TestList tests, boolean baby, boolean timer) { + this.description = description; + this.klassen = klassen; + this.tests = tests; + this.baby = baby; + this.timer = timer; } - - public Exercise(){ - - + + public Exercise() { + } - public boolean codeCompiles(){ - + + public boolean codeCompiles() { + return this.klassen.compilable(); } - - public boolean testsRunning(){ - + + public boolean testsRunning() { + return this.tests.allPassing(); } diff --git a/src/FileHandling/Loader.java b/src/FileHandling/Loader.java index 4e8d112..83d54d6 100644 --- a/src/FileHandling/Loader.java +++ b/src/FileHandling/Loader.java @@ -1,4 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package FileHandling; + import org.xml.sax.*; import javafx.scene.Scene; @@ -13,49 +27,42 @@ import javax.xml.parsers.*; - public class Loader { - - public Exercise loadExcercise(){ - Stage loadStage= new Stage(); - TextField fileName=new TextField("Katalogdatei"); - Label anzeige=new Label(""); - - - - - Button laden=new Button("Katalog laden"); - laden.setOnAction(e-> laden(fileName.getText(),anzeige,loadStage)); - + + public Exercise loadExcercise() { + Stage loadStage = new Stage(); + TextField fileName = new TextField("Katalogdatei"); + Label anzeige = new Label(""); + + Button laden = new Button("Katalog laden"); + laden.setOnAction(e -> laden(fileName.getText(), anzeige, loadStage)); + return null; } - private void laden(String filename,Label anzeige,Stage stage) { + private void laden(String filename, Label anzeige, Stage stage) { try { - Document xmldoc=loadDoc(filename); - Scene choiseScreen=katalogView(xmldoc); - + Document xmldoc = loadDoc(filename); + Scene choiseScreen = katalogView(xmldoc); + } catch (SAXException | IOException e) { anzeige.setText("Datei nicht vorhanden oder nicht kompatibel"); e.printStackTrace(); } - - + } - - + private Scene katalogView(Document xmldoc) { - + return null; } - private Document loadDoc(String fileLocation) throws SAXException, IOException{ - DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance(); + private Document loadDoc(String fileLocation) throws SAXException, IOException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document toReturn; factory.setIgnoringComments(true); factory.setValidating(true); - - + DocumentBuilder builder; try { builder = factory.newDocumentBuilder(); @@ -64,10 +71,5 @@ private Document loadDoc(String fileLocation) throws SAXException, IOException{ e.printStackTrace(); return null; } - - - - - } } diff --git a/src/FileHandling/Store.java b/src/FileHandling/Store.java index d5e2d72..9ba8060 100644 --- a/src/FileHandling/Store.java +++ b/src/FileHandling/Store.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package FileHandling; public class Store { diff --git a/src/FileHandling/Test.java b/src/FileHandling/Test.java index ffda0a8..f250fd6 100644 --- a/src/FileHandling/Test.java +++ b/src/FileHandling/Test.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package FileHandling; import vk.core.api.CompilationUnit; @@ -10,30 +23,33 @@ public class Test { private String testCode; private CompilationUnit compilationUnitTest; - - public Test(String testCode, String testName){ - this.testCode=testCode; - this.compilationUnitTest= new CompilationUnit(testName, testCode, true); + + public Test(String testCode, String testName) { + this.testCode = testCode; + this.compilationUnitTest = new CompilationUnit(testName, testCode, true); } - - public boolean oneTestFailing(){ + + public boolean oneTestFailing() { JavaStringCompiler compiler = CompilerFactory.getCompiler(compilationUnitTest); compiler.compileAndRunTests(); TestResult result = compiler.getTestResult(); int fails = result.getNumberOfFailedTests(); - - if(fails == 1) return true; - return false; //mehr als ein test schl�gt fehl sollte nicht sein im tddt kreislauf + + if (fails == 1) + return true; + return false; // mehr als ein test schlägt fehl sollte nicht sein im + // tddt kreislauf } - - public boolean allTestsPassing(){ + + public boolean allTestsPassing() { JavaStringCompiler compiler = CompilerFactory.getCompiler(compilationUnitTest); compiler.compileAndRunTests(); TestResult result = compiler.getTestResult(); int fails = result.getNumberOfFailedTests(); - - if(fails == 0) return true; + + if (fails == 0) + return true; return false; - + } } diff --git a/src/FileHandling/TestList.java b/src/FileHandling/TestList.java index 817c6f8..23405aa 100644 --- a/src/FileHandling/TestList.java +++ b/src/FileHandling/TestList.java @@ -1,25 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package FileHandling; import java.util.ArrayList; -public class TestList extends ArrayList{ +public class TestList extends ArrayList { private static final long serialVersionUID = 1L; private boolean running; - - public TestList(){ + public TestList() { super(); } - - public boolean allPassing(){ - - Test[] codeArray = (Test[]) this.toArray(); - - for(int i = 0; i< codeArray.length; i++){ - running = codeArray[i].oneTestFailing(); - - if(running == false) return false; + + public boolean allPassing() { + + Object[] codeArray = this.toArray(); + + for (int i = 0; i < codeArray.length; i++) { + running = ((Test) codeArray[i]).oneTestFailing(); + + if (running == false) + return false; } return true; } diff --git a/src/FileHandling/excercises.dtd b/src/FileHandling/excercises.dtd index 1108bc0..8dbc8ac 100644 --- a/src/FileHandling/excercises.dtd +++ b/src/FileHandling/excercises.dtd @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/src/GUI/Controller.class b/src/GUI/Controller.class deleted file mode 100644 index fa5e81c..0000000 Binary files a/src/GUI/Controller.class and /dev/null differ diff --git a/src/GUI/Controller.java b/src/GUI/Controller.java index 6dcabe8..9af8c97 100644 --- a/src/GUI/Controller.java +++ b/src/GUI/Controller.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package GUI; import javafx.fxml.FXML; @@ -5,19 +18,21 @@ public class Controller { + @FXML + private TextArea Area1; + @FXML + private TextArea Area2; - @FXML private TextArea Area1; - @FXML private TextArea Area2; - - @FXML protected void SwitchArea() { - if (Area1.isDisable()) { - Area1.setDisable(false); - Area2.setDisable(true); - Area1.requestFocus(); - } else { - Area2.setDisable(false); - Area1.setDisable(true); - Area2.requestFocus(); - } - } + @FXML + protected void SwitchArea() { + if (Area1.isDisable()) { + Area1.setDisable(false); + Area2.setDisable(true); + Area1.requestFocus(); + } else { + Area2.setDisable(false); + Area1.setDisable(true); + Area2.requestFocus(); + } + } } diff --git a/src/GUI/GUIMain.class b/src/GUI/GUIMain.class deleted file mode 100644 index 704c958..0000000 Binary files a/src/GUI/GUIMain.class and /dev/null differ diff --git a/src/GUI/GUIMain.java b/src/GUI/GUIMain.java index 97e896a..368e850 100644 --- a/src/GUI/GUIMain.java +++ b/src/GUI/GUIMain.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package GUI; import javafx.application.Application; @@ -6,17 +19,16 @@ import javafx.scene.layout.Pane; import javafx.stage.Stage; +public class GUIMain extends Application { -public class GUIMain extends Application{ + public static void main(String[] args) { + launch(args); + } - public static void main(String[] args){ - launch(args); - } - - public void start(Stage stage) throws Exception { - Pane root = (Pane) FXMLLoader.load(getClass().getResource("ProPra.fxml")); - Scene scene = new Scene(root); - stage.setScene(scene); - stage.show(); - } + public void start(Stage stage) throws Exception { + Pane root = (Pane) FXMLLoader.load(getClass().getResource("ProPra.fxml")); + Scene scene = new Scene(root); + stage.setScene(scene); + stage.show(); + } } diff --git a/src/application/Main.java b/src/application/Main.java index 66388cd..f3ba3fe 100644 --- a/src/application/Main.java +++ b/src/application/Main.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package application; public class Main { diff --git a/src/application/daten/Katalog.java b/src/application/daten/Katalog.java deleted file mode 100644 index f379ef7..0000000 --- a/src/application/daten/Katalog.java +++ /dev/null @@ -1,5 +0,0 @@ -package application.daten; - -public class Katalog { - -} diff --git a/src/application/daten/Text.java b/src/application/daten/Text.java deleted file mode 100644 index e9ec0f6..0000000 --- a/src/application/daten/Text.java +++ /dev/null @@ -1,5 +0,0 @@ -package application.daten; - -public class Text { - -} diff --git a/src/application/logik/Logik.java b/src/application/logik/Logik.java index b072f0d..995ad6f 100644 --- a/src/application/logik/Logik.java +++ b/src/application/logik/Logik.java @@ -1,34 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package application.logik; import FileHandling.Exercise; public class Logik implements LogikZuGui{ - + + Exercise e = new Exercise(); + @Override - public void save() { - // TODO Auto-generated method stub + public void save() { //Tests und Programmcode in Dateien speichern + } @Override - public void loadKatalog() { - // TODO Auto-generated method stub + public void loadKatalog() { //Den katalog laden und tddt entsprechend einrichten + } @Override - public void nextStep() { - if(isCompileable()){ + public void nextStep() { //wenn der code kompiliert, wird zum nächsten schritt gewechselt + if(e.codeCompiles()){ } } - private boolean isCompileable(){ - if(true){ - return true; + + private void countdown(long minuten){ //wenn aktiviert, wird + long t1 = 0; + long t2 = System.nanoTime(); + long deltaT = t2 - t1; + while(minuten-deltaT != 0){ + } - return false; } } diff --git a/src/application/logik/LogikZuGui.java b/src/application/logik/LogikZuGui.java index 35925d4..bb7980d 100644 --- a/src/application/logik/LogikZuGui.java +++ b/src/application/logik/LogikZuGui.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2016 The Fellowship of the String and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marcel Beek - initial API and implementation + * Patrick Pirig - initial API and implementation + * Phillippe Weise - initial API and implementation + * Sabine Timmer - initial API and implementation + *******************************************************************************/ package application.logik; public interface LogikZuGui { diff --git a/src/tests/TestMain.java b/src/tests/TestMain.java deleted file mode 100644 index 0d3d8a7..0000000 --- a/src/tests/TestMain.java +++ /dev/null @@ -1,14 +0,0 @@ -package tests; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class TestMain { - - @Test - public void test() { - fail("Not yet implemented"); - } - -}