parent
471ad99190
commit
21c072fe7a
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
path.variable.kotlin_bundled=C\:\\Program Files\\JetBrains\\IntelliJ IDEA 2017.2.3\\plugins\\Kotlin\\kotlinc
|
||||
path.variable.maven_repository=C\:\\Users\\Armin\\.m2\\repository
|
||||
jdk.home.1.8=C\:/Program Files/Java/jdk1.8.0_121
|
||||
javac2.instrumentation.includeJavaRuntime=false
|
@ -1,182 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="masterarbeit" default="all">
|
||||
|
||||
|
||||
<property file="masterarbeit.properties"/>
|
||||
<!-- Uncomment the following property if no tests compilation is needed -->
|
||||
<!--
|
||||
<property name="skip.tests" value="true"/>
|
||||
-->
|
||||
|
||||
<!-- Compiler options -->
|
||||
|
||||
<property name="compiler.debug" value="on"/>
|
||||
<property name="compiler.generate.no.warnings" value="off"/>
|
||||
<property name="compiler.args" value=""/>
|
||||
<property name="compiler.max.memory" value="6500m"/>
|
||||
<patternset id="ignored.files">
|
||||
<exclude name="**/*.hprof/**"/>
|
||||
<exclude name="**/*.pyc/**"/>
|
||||
<exclude name="**/*.pyo/**"/>
|
||||
<exclude name="**/*.rbc/**"/>
|
||||
<exclude name="**/*.yarb/**"/>
|
||||
<exclude name="**/*~/**"/>
|
||||
<exclude name="**/.DS_Store/**"/>
|
||||
<exclude name="**/.git/**"/>
|
||||
<exclude name="**/.hg/**"/>
|
||||
<exclude name="**/.svn/**"/>
|
||||
<exclude name="**/CVS/**"/>
|
||||
<exclude name="**/__pycache__/**"/>
|
||||
<exclude name="**/_svn/**"/>
|
||||
<exclude name="**/vssver.scc/**"/>
|
||||
<exclude name="**/vssver2.scc/**"/>
|
||||
</patternset>
|
||||
<patternset id="library.patterns">
|
||||
<include name="*.egg"/>
|
||||
<include name="*.jar"/>
|
||||
<include name="*.ear"/>
|
||||
<include name="*.swc"/>
|
||||
<include name="*.war"/>
|
||||
<include name="*.ane"/>
|
||||
<include name="*.zip"/>
|
||||
</patternset>
|
||||
<patternset id="compiler.resources">
|
||||
<exclude name="**/?*.java"/>
|
||||
<exclude name="**/?*.form"/>
|
||||
<exclude name="**/?*.class"/>
|
||||
<exclude name="**/?*.groovy"/>
|
||||
<exclude name="**/?*.scala"/>
|
||||
<exclude name="**/?*.flex"/>
|
||||
<exclude name="**/?*.kt"/>
|
||||
<exclude name="**/?*.clj"/>
|
||||
<exclude name="**/?*.aj"/>
|
||||
</patternset>
|
||||
|
||||
<!-- JDK definitions -->
|
||||
|
||||
<property name="jdk.bin.1.8" value="${jdk.home.1.8}/bin"/>
|
||||
<path id="jdk.classpath.1.8">
|
||||
<fileset dir="${jdk.home.1.8}">
|
||||
<include name="jre/lib/charsets.jar"/>
|
||||
<include name="jre/lib/deploy.jar"/>
|
||||
<include name="jre/lib/ext/access-bridge-64.jar"/>
|
||||
<include name="jre/lib/ext/cldrdata.jar"/>
|
||||
<include name="jre/lib/ext/dnsns.jar"/>
|
||||
<include name="jre/lib/ext/jaccess.jar"/>
|
||||
<include name="jre/lib/ext/jfxrt.jar"/>
|
||||
<include name="jre/lib/ext/localedata.jar"/>
|
||||
<include name="jre/lib/ext/nashorn.jar"/>
|
||||
<include name="jre/lib/ext/sunec.jar"/>
|
||||
<include name="jre/lib/ext/sunjce_provider.jar"/>
|
||||
<include name="jre/lib/ext/sunmscapi.jar"/>
|
||||
<include name="jre/lib/ext/sunpkcs11.jar"/>
|
||||
<include name="jre/lib/ext/zipfs.jar"/>
|
||||
<include name="jre/lib/javaws.jar"/>
|
||||
<include name="jre/lib/jce.jar"/>
|
||||
<include name="jre/lib/jfr.jar"/>
|
||||
<include name="jre/lib/jfxswt.jar"/>
|
||||
<include name="jre/lib/jsse.jar"/>
|
||||
<include name="jre/lib/management-agent.jar"/>
|
||||
<include name="jre/lib/plugin.jar"/>
|
||||
<include name="jre/lib/resources.jar"/>
|
||||
<include name="jre/lib/rt.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<property name="project.jdk.home" value="${jdk.home.1.8}"/>
|
||||
<property name="project.jdk.bin" value="${jdk.bin.1.8}"/>
|
||||
<property name="project.jdk.classpath" value="jdk.classpath.1.8"/>
|
||||
|
||||
|
||||
<!-- Project Libraries -->
|
||||
|
||||
<path id="library.maven:_bouncycastle:bcmail-jdk14:138.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/bouncycastle/bcmail-jdk14/138/bcmail-jdk14-138.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_bouncycastle:bcprov-jdk14:138.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/bouncycastle/bcprov-jdk14/138/bcprov-jdk14-138.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_com.jtattoo:jtattoo:1.6.11.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/com/jtattoo/JTattoo/1.6.11/JTattoo-1.6.11.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_com.lowagie:itext:2.1.5.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/com/lowagie/itext/2.1.5/itext-2.1.5.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_com.opencsv:opencsv:3.9.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/com/opencsv/opencsv/3.9/opencsv-3.9.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_commons-beanutils:commons-beanutils:1.9.3.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_commons-collections:commons-collections:3.2.2.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_commons-io:commons-io:1.3.2.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_commons-logging:commons-logging:1.2.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_junit:junit:4.12.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/junit/junit/4.12/junit-4.12.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_org.apache.commons:commons-lang3:3.5.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_org.jfree:jcommon:1.0.17.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/org/jfree/jcommon/1.0.17/jcommon-1.0.17.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_org.jfree:jfreechart:1.0.14.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/org/jfree/jfreechart/1.0.14/jfreechart-1.0.14.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_org:opencv:2.4.13.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/org/opencv/2.4.13/opencv-2.4.13.jar"/>
|
||||
</path>
|
||||
|
||||
<path id="library.maven:_xml-apis:xml-apis:1.3.04.classpath">
|
||||
<pathelement location="${path.variable.maven_repository}/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar"/>
|
||||
</path>
|
||||
<!-- Register Custom Compiler Taskdefs -->
|
||||
<property name="javac2.home" value="${idea.home}/lib"/>
|
||||
<path id="javac2.classpath">
|
||||
<pathelement location="${javac2.home}/javac2.jar"/>
|
||||
<pathelement location="${javac2.home}/jdom.jar"/>
|
||||
<pathelement location="${javac2.home}/asm-all.jar"/>
|
||||
<pathelement location="${javac2.home}/jgoodies-forms.jar"/>
|
||||
</path>
|
||||
<target name="register.custom.compilers">
|
||||
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
|
||||
<taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
|
||||
</target>
|
||||
|
||||
<!-- Modules -->
|
||||
|
||||
<import file="${basedir}/module_masterarbeit.xml"/>
|
||||
|
||||
<target name="init" description="Build initialization">
|
||||
<!-- Perform any build initialization in this target -->
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="clean.module.masterarbeit" description="cleanup all"/>
|
||||
|
||||
<target name="build.modules" depends="init, clean, compile.module.masterarbeit" description="build all modules"/>
|
||||
|
||||
<target name="all" depends="build.modules" description="build all"/>
|
||||
</project>
|
@ -1,177 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="module_masterarbeit" default="compile.module.masterarbeit">
|
||||
<dirname property="module.masterarbeit.basedir" file="${ant.file.module_masterarbeit}"/>
|
||||
|
||||
<property name="module.jdk.home.masterarbeit" value="${project.jdk.home}"/>
|
||||
<property name="module.jdk.bin.masterarbeit" value="${project.jdk.bin}"/>
|
||||
<property name="module.jdk.classpath.masterarbeit" value="${project.jdk.classpath}"/>
|
||||
|
||||
<property name="compiler.args.masterarbeit" value="-encoding UTF-8 -source 1.8 -target 1.8 ${compiler.args}"/>
|
||||
|
||||
<property name="masterarbeit.output.dir" value="${module.masterarbeit.basedir}/target/classes"/>
|
||||
<property name="masterarbeit.testoutput.dir" value="${module.masterarbeit.basedir}/target/test-classes"/>
|
||||
|
||||
<path id="masterarbeit.module.bootclasspath">
|
||||
<!-- Paths to be included in compilation bootclasspath -->
|
||||
</path>
|
||||
|
||||
<path id="masterarbeit.module.production.classpath">
|
||||
<path refid="${module.jdk.classpath.masterarbeit}"/>
|
||||
<pathelement location="${basedir}/../../../Downloads/opencv/build/java/opencv-2413.jar"/>
|
||||
<pathelement location="${basedir}/libs/opencv-2413.jar"/>
|
||||
<path refid="library.maven:_org.jfree:jfreechart:1.0.14.classpath"/>
|
||||
<path refid="library.maven:_org.jfree:jcommon:1.0.17.classpath"/>
|
||||
<path refid="library.maven:_xml-apis:xml-apis:1.3.04.classpath"/>
|
||||
<path refid="library.maven:_com.lowagie:itext:2.1.5.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcmail-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcprov-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_junit:junit:4.12.classpath"/>
|
||||
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||
<path refid="library.maven:_com.opencsv:opencsv:3.9.classpath"/>
|
||||
<path refid="library.maven:_org.apache.commons:commons-lang3:3.5.classpath"/>
|
||||
<path refid="library.maven:_commons-beanutils:commons-beanutils:1.9.3.classpath"/>
|
||||
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||
<path refid="library.maven:_commons-collections:commons-collections:3.2.2.classpath"/>
|
||||
<path refid="library.maven:_com.jtattoo:jtattoo:1.6.11.classpath"/>
|
||||
<path refid="library.maven:_org:opencv:2.4.13.classpath"/>
|
||||
<path refid="library.maven:_commons-io:commons-io:1.3.2.classpath"/>
|
||||
</path>
|
||||
|
||||
<path id="masterarbeit.runtime.production.module.classpath">
|
||||
<pathelement location="${masterarbeit.output.dir}"/>
|
||||
<pathelement location="${basedir}/../../../Downloads/opencv/build/java/opencv-2413.jar"/>
|
||||
<pathelement location="${basedir}/libs/opencv-2413.jar"/>
|
||||
<path refid="library.maven:_org.jfree:jfreechart:1.0.14.classpath"/>
|
||||
<path refid="library.maven:_org.jfree:jcommon:1.0.17.classpath"/>
|
||||
<path refid="library.maven:_xml-apis:xml-apis:1.3.04.classpath"/>
|
||||
<path refid="library.maven:_com.lowagie:itext:2.1.5.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcmail-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcprov-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_junit:junit:4.12.classpath"/>
|
||||
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||
<path refid="library.maven:_com.opencsv:opencsv:3.9.classpath"/>
|
||||
<path refid="library.maven:_org.apache.commons:commons-lang3:3.5.classpath"/>
|
||||
<path refid="library.maven:_commons-beanutils:commons-beanutils:1.9.3.classpath"/>
|
||||
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||
<path refid="library.maven:_commons-collections:commons-collections:3.2.2.classpath"/>
|
||||
<path refid="library.maven:_com.jtattoo:jtattoo:1.6.11.classpath"/>
|
||||
<path refid="library.maven:_org:opencv:2.4.13.classpath"/>
|
||||
<path refid="library.maven:_commons-io:commons-io:1.3.2.classpath"/>
|
||||
</path>
|
||||
|
||||
<path id="masterarbeit.module.classpath">
|
||||
<path refid="${module.jdk.classpath.masterarbeit}"/>
|
||||
<pathelement location="${masterarbeit.output.dir}"/>
|
||||
<pathelement location="${basedir}/../../../Downloads/opencv/build/java/opencv-2413.jar"/>
|
||||
<pathelement location="${basedir}/libs/opencv-2413.jar"/>
|
||||
<path refid="library.maven:_org.jfree:jfreechart:1.0.14.classpath"/>
|
||||
<path refid="library.maven:_org.jfree:jcommon:1.0.17.classpath"/>
|
||||
<path refid="library.maven:_xml-apis:xml-apis:1.3.04.classpath"/>
|
||||
<path refid="library.maven:_com.lowagie:itext:2.1.5.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcmail-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcprov-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_junit:junit:4.12.classpath"/>
|
||||
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||
<path refid="library.maven:_com.opencsv:opencsv:3.9.classpath"/>
|
||||
<path refid="library.maven:_org.apache.commons:commons-lang3:3.5.classpath"/>
|
||||
<path refid="library.maven:_commons-beanutils:commons-beanutils:1.9.3.classpath"/>
|
||||
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||
<path refid="library.maven:_commons-collections:commons-collections:3.2.2.classpath"/>
|
||||
<path refid="library.maven:_com.jtattoo:jtattoo:1.6.11.classpath"/>
|
||||
<path refid="library.maven:_org:opencv:2.4.13.classpath"/>
|
||||
<path refid="library.maven:_commons-io:commons-io:1.3.2.classpath"/>
|
||||
</path>
|
||||
|
||||
<path id="masterarbeit.runtime.module.classpath">
|
||||
<pathelement location="${masterarbeit.testoutput.dir}"/>
|
||||
<pathelement location="${masterarbeit.output.dir}"/>
|
||||
<pathelement location="${basedir}/../../../Downloads/opencv/build/java/opencv-2413.jar"/>
|
||||
<pathelement location="${basedir}/libs/opencv-2413.jar"/>
|
||||
<path refid="library.maven:_org.jfree:jfreechart:1.0.14.classpath"/>
|
||||
<path refid="library.maven:_org.jfree:jcommon:1.0.17.classpath"/>
|
||||
<path refid="library.maven:_xml-apis:xml-apis:1.3.04.classpath"/>
|
||||
<path refid="library.maven:_com.lowagie:itext:2.1.5.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcmail-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_bouncycastle:bcprov-jdk14:138.classpath"/>
|
||||
<path refid="library.maven:_junit:junit:4.12.classpath"/>
|
||||
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||
<path refid="library.maven:_com.opencsv:opencsv:3.9.classpath"/>
|
||||
<path refid="library.maven:_org.apache.commons:commons-lang3:3.5.classpath"/>
|
||||
<path refid="library.maven:_commons-beanutils:commons-beanutils:1.9.3.classpath"/>
|
||||
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||
<path refid="library.maven:_commons-collections:commons-collections:3.2.2.classpath"/>
|
||||
<path refid="library.maven:_com.jtattoo:jtattoo:1.6.11.classpath"/>
|
||||
<path refid="library.maven:_org:opencv:2.4.13.classpath"/>
|
||||
<path refid="library.maven:_commons-io:commons-io:1.3.2.classpath"/>
|
||||
</path>
|
||||
|
||||
|
||||
<patternset id="excluded.from.module.masterarbeit">
|
||||
<patternset refid="ignored.files"/>
|
||||
</patternset>
|
||||
|
||||
<patternset id="excluded.from.compilation.masterarbeit">
|
||||
<patternset refid="excluded.from.module.masterarbeit"/>
|
||||
</patternset>
|
||||
|
||||
<path id="masterarbeit.module.sourcepath">
|
||||
<dirset dir="${module.masterarbeit.basedir}">
|
||||
<include name="src/main/java"/>
|
||||
<include name="src/main/resources"/>
|
||||
</dirset>
|
||||
</path>
|
||||
|
||||
<path id="masterarbeit.module.test.sourcepath">
|
||||
<dirset dir="${module.masterarbeit.basedir}">
|
||||
<include name="src/test/java"/>
|
||||
</dirset>
|
||||
</path>
|
||||
|
||||
|
||||
<target name="compile.module.masterarbeit" depends="compile.module.masterarbeit.production,compile.module.masterarbeit.tests" description="Compile module masterarbeit"/>
|
||||
|
||||
<target name="compile.module.masterarbeit.production" depends="register.custom.compilers" description="Compile module masterarbeit; production classes">
|
||||
<mkdir dir="${masterarbeit.output.dir}"/>
|
||||
<javac2 destdir="${masterarbeit.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.masterarbeit}/javac">
|
||||
<compilerarg line="${compiler.args.masterarbeit}"/>
|
||||
<bootclasspath refid="masterarbeit.module.bootclasspath"/>
|
||||
<classpath refid="masterarbeit.module.production.classpath"/>
|
||||
<src refid="masterarbeit.module.sourcepath"/>
|
||||
<patternset refid="excluded.from.compilation.masterarbeit"/>
|
||||
</javac2>
|
||||
|
||||
<copy todir="${masterarbeit.output.dir}">
|
||||
<fileset dir="${module.masterarbeit.basedir}/src/main/java">
|
||||
<patternset refid="compiler.resources"/>
|
||||
<type type="file"/>
|
||||
</fileset>
|
||||
<fileset dir="${module.masterarbeit.basedir}/src/main/resources">
|
||||
<patternset refid="compiler.resources"/>
|
||||
<type type="file"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="compile.module.masterarbeit.tests" depends="register.custom.compilers,compile.module.masterarbeit.production" description="compile module masterarbeit; test classes" unless="skip.tests">
|
||||
<mkdir dir="${masterarbeit.testoutput.dir}"/>
|
||||
<javac2 destdir="${masterarbeit.testoutput.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.masterarbeit}/javac">
|
||||
<compilerarg line="${compiler.args.masterarbeit}"/>
|
||||
<bootclasspath refid="masterarbeit.module.bootclasspath"/>
|
||||
<classpath refid="masterarbeit.module.classpath"/>
|
||||
<src refid="masterarbeit.module.test.sourcepath"/>
|
||||
<patternset refid="excluded.from.compilation.masterarbeit"/>
|
||||
</javac2>
|
||||
|
||||
<copy todir="${masterarbeit.testoutput.dir}">
|
||||
<fileset dir="${module.masterarbeit.basedir}/src/test/java">
|
||||
<patternset refid="compiler.resources"/>
|
||||
<type type="file"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="clean.module.masterarbeit" description="cleanup module">
|
||||
<delete dir="${masterarbeit.output.dir}"/>
|
||||
<delete dir="${masterarbeit.testoutput.dir}"/>
|
||||
</target>
|
||||
</project>
|
@ -1,136 +0,0 @@
|
||||
import model.Line;
|
||||
import model.LineModel;
|
||||
import model.Point;
|
||||
import presenter.Presenter;
|
||||
import presenter.algorithms.advanced.LeastMedianOfSquaresEstimator;
|
||||
import presenter.algorithms.advanced.RepeatedMedianEstimator;
|
||||
import presenter.algorithms.advanced.TheilSenEstimator;
|
||||
import presenter.algorithms.naiv.NaivLeastMedianOfSquaresEstimator;
|
||||
import presenter.algorithms.naiv.NaivRepeatedMedianEstimator;
|
||||
import presenter.algorithms.naiv.NaivTheilSenEstimator;
|
||||
import presenter.generator.DatasetGenerator;
|
||||
import presenter.util.IntersectionComputer;
|
||||
import view.MainFrame;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
||||
*
|
||||
* @Author: Armin Wolf
|
||||
* @Email: a_wolf28@uni-muenster.de
|
||||
* @Date: 28.05.2017.
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Laden der native Library für OpenCV
|
||||
*/
|
||||
static {
|
||||
nu.pattern.OpenCV.loadShared();
|
||||
System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schriftart wird neu gesetzt
|
||||
*
|
||||
* @param f Schriftart
|
||||
*/
|
||||
private static void setUIFont(javax.swing.plaf.FontUIResource f) {
|
||||
java.util.Enumeration<Object> keys = UIManager.getDefaults().keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
Object key = keys.nextElement();
|
||||
Object value = UIManager.get(key);
|
||||
if (value instanceof javax.swing.plaf.FontUIResource) {
|
||||
UIManager.put(key, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Das LookAndFeel wird neu gesetzt.
|
||||
*
|
||||
* @param view View Klasse
|
||||
*/
|
||||
private static void setLookAndFeel(JFrame view) {
|
||||
String[] laf = {"com.jtattoo.plaf.aluminium.AluminiumLookAndFeel",
|
||||
"com.jtattoo.plaf.acryl.AcrylLookAndFeel",
|
||||
"com.jtattoo.plaf.aero.AeroLookAndFeel",
|
||||
"com.jtattoo.plaf.fast.FastLookAndFeel",
|
||||
"com.jtattoo.plaf.graphite.GraphiteLookAndFeel",
|
||||
"com.jtattoo.plaf.luna.LunaLookAndFeel",
|
||||
"com.jtattoo.plaf.noire.NoireLookAndFeel"};
|
||||
try {
|
||||
UIManager.setLookAndFeel(laf[4]);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedLookAndFeelException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SwingUtilities.updateComponentTreeUI(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Die Methode rechnet für gegebene Größen die Algorithmen durch und gibt jeweils die benötigte Zeit
|
||||
*/
|
||||
public static void benchmark() {
|
||||
int[] sizes = {50, 500, 1000, 3000, 5000, 10000};
|
||||
|
||||
for (int i = 5; i < sizes.length; i++) {
|
||||
System.out.println("---- Datasetgröße: " + sizes[i] + " ----");
|
||||
DatasetGenerator generator = new DatasetGenerator();
|
||||
LinkedList<Line> lines = generator.generateDataCloud(sizes[i]);
|
||||
IntersectionComputer computer = new IntersectionComputer(lines);
|
||||
ArrayList<Point> points = computer.compute();
|
||||
|
||||
NaivLeastMedianOfSquaresEstimator naivLms = new NaivLeastMedianOfSquaresEstimator(lines);
|
||||
naivLms.run();
|
||||
|
||||
NaivRepeatedMedianEstimator naivRm = new NaivRepeatedMedianEstimator(lines);
|
||||
naivRm.run();
|
||||
|
||||
NaivTheilSenEstimator naivTs = new NaivTheilSenEstimator(lines);
|
||||
naivTs.run();
|
||||
|
||||
LeastMedianOfSquaresEstimator lms = new LeastMedianOfSquaresEstimator(lines, points);
|
||||
lms.run();
|
||||
|
||||
RepeatedMedianEstimator rm = new RepeatedMedianEstimator(lines);
|
||||
rm.run();
|
||||
|
||||
TheilSenEstimator ts = new TheilSenEstimator(lines, points);
|
||||
ts.run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maim Methode
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
if (args.length > 0 && args[0] == "--benchmark") {
|
||||
benchmark();
|
||||
} else {
|
||||
final Presenter presenter = new Presenter(new LineModel(), null);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
//JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
MainFrame view = new MainFrame();
|
||||
setLookAndFeel(view);
|
||||
setUIFont(new javax.swing.plaf.FontUIResource(new Font("SansSerif", Font.PLAIN, 12)));
|
||||
|
||||
view.setPresenter(presenter);
|
||||
view.setActionListeners();
|
||||
presenter.setView(view);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package de.wwwu.awolf;
|
||||
|
||||
import de.wwwu.awolf.model.Line;
|
||||
import de.wwwu.awolf.model.LineModel;
|
||||
import de.wwwu.awolf.model.Point;
|
||||
import de.wwwu.awolf.presenter.Presenter;
|
||||
import de.wwwu.awolf.presenter.algorithms.advanced.LeastMedianOfSquaresEstimator;
|
||||
import de.wwwu.awolf.presenter.algorithms.advanced.RepeatedMedianEstimator;
|
||||
import de.wwwu.awolf.presenter.algorithms.advanced.TheilSenEstimator;
|
||||
import de.wwwu.awolf.presenter.algorithms.naiv.NaivLeastMedianOfSquaresEstimator;
|
||||
import de.wwwu.awolf.presenter.algorithms.naiv.NaivRepeatedMedianEstimator;
|
||||
import de.wwwu.awolf.presenter.algorithms.naiv.NaivTheilSenEstimator;
|
||||
import de.wwwu.awolf.presenter.generator.DatasetGenerator;
|
||||
import de.wwwu.awolf.presenter.util.IntersectionComputer;
|
||||
import de.wwwu.awolf.presenter.util.Logging;
|
||||
import de.wwwu.awolf.view.MainFrame;
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
||||
*
|
||||
* @Author: Armin Wolf
|
||||
* @Email: a_wolf28@uni-muenster.de
|
||||
* @Date: 28.05.2017.
|
||||
*/
|
||||
public class App {
|
||||
|
||||
|
||||
/**
|
||||
* Schriftart wird neu gesetzt
|
||||
*
|
||||
* @param f Schriftart
|
||||
*/
|
||||
private static void setUIFont(javax.swing.plaf.FontUIResource f) {
|
||||
java.util.Enumeration<Object> keys = UIManager.getDefaults().keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
Object key = keys.nextElement();
|
||||
Object value = UIManager.get(key);
|
||||
if (value instanceof javax.swing.plaf.FontUIResource) {
|
||||
UIManager.put(key, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Die Methode rechnet für gegebene Größen die Algorithmen durch und gibt jeweils die benötigte Zeit
|
||||
*/
|
||||
public static void benchmark() {
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(6);
|
||||
|
||||
Logging.logInfo("---- Datasetgröße: " + 100 + " ----");
|
||||
DatasetGenerator generator = new DatasetGenerator();
|
||||
LinkedList<Line> lines = generator.generateDataCloud(10000);
|
||||
IntersectionComputer computer = new IntersectionComputer(lines);
|
||||
ArrayList<Point> points = computer.compute();
|
||||
|
||||
executorService.submit(new NaivLeastMedianOfSquaresEstimator(lines));
|
||||
executorService.submit(new NaivRepeatedMedianEstimator(lines));
|
||||
executorService.submit(new NaivTheilSenEstimator(lines));
|
||||
executorService.submit(new LeastMedianOfSquaresEstimator(lines, points));
|
||||
executorService.submit(new RepeatedMedianEstimator(lines));
|
||||
executorService.submit(new TheilSenEstimator(lines, points));
|
||||
}
|
||||
|
||||
/**
|
||||
* Maim Methode
|
||||
*
|
||||
* @param argv
|
||||
*/
|
||||
public static void main(String[] argv) {
|
||||
|
||||
Options options = new Options();
|
||||
options.addOption("benchmark", "Start stresstest");
|
||||
options.addOption("", "default");
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
|
||||
try {
|
||||
CommandLine line = parser.parse(options, argv); // Sensitive
|
||||
String[] args = line.getArgs();
|
||||
if (args.length > 0 && args[0].equals("benchmark")) {
|
||||
benchmark();
|
||||
} else {
|
||||
final Presenter presenter = new Presenter(new LineModel(), null);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
MainFrame view = new MainFrame();
|
||||
setUIFont(new javax.swing.plaf.FontUIResource(new Font("SansSerif", Font.PLAIN, 12)));
|
||||
try {
|
||||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||
} catch (ClassNotFoundException | UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException e) {
|
||||
Logging.logError("Error with the UI. ", e);
|
||||
}
|
||||
|
||||
view.setPresenter(presenter);
|
||||
view.setActionListeners();
|
||||
presenter.setView(view);
|
||||
});
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
Logging.logError("Error while parsing the command line arguments.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package model;
|
||||
package de.wwwu.awolf.model;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
@ -1,4 +1,4 @@
|
||||
package model;
|
||||
package de.wwwu.awolf.model;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
@ -0,0 +1,27 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
import de.wwwu.awolf.model.Line;
|
||||
|
||||
public class AlgorithmData implements Data {
|
||||
|
||||
private SubscriberType type;
|
||||
private Line lineData;
|
||||
|
||||
@Override
|
||||
public SubscriberType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(SubscriberType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Line getLineData() {
|
||||
return lineData;
|
||||
}
|
||||
|
||||
public void setLineData(Line lineData) {
|
||||
this.lineData = lineData;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
public interface Data {
|
||||
SubscriberType getType();
|
||||
|
||||
void setType(SubscriberType type);
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
import de.wwwu.awolf.presenter.algorithms.Algorithm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EvaluationData implements Data {
|
||||
private SubscriberType type;
|
||||
private List<Algorithm.Type> algorithmtypes;
|
||||
private List<Double> oneColumnresult;
|
||||
private List<List<String>> multipleColumnResult;
|
||||
private int column;
|
||||
private List<String> labels;
|
||||
|
||||
public List<Algorithm.Type> getAlgorithmtypes() {
|
||||
return algorithmtypes;
|
||||
}
|
||||
|
||||
public void setAlgorithmtypes(List<Algorithm.Type> algorithmtype) {
|
||||
this.algorithmtypes = algorithmtype;
|
||||
}
|
||||
|
||||
public List<Double> getOneColumnresult() {
|
||||
return oneColumnresult;
|
||||
}
|
||||
|
||||
public void setOneColumnresult(List<Double> oneColumnresult) {
|
||||
this.oneColumnresult = oneColumnresult;
|
||||
}
|
||||
|
||||
public List<List<String>> getMultipleColumnResult() {
|
||||
return multipleColumnResult;
|
||||
}
|
||||
|
||||
public void setMultipleColumnResult(List<List<String>> multipleColumnResult) {
|
||||
this.multipleColumnResult = multipleColumnResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubscriberType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(SubscriberType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setColumn(int col) {
|
||||
this.column = col;
|
||||
}
|
||||
|
||||
public void setLabels(List<String> tableInput) {
|
||||
this.labels = tableInput;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
public class ExportData implements Data {
|
||||
|
||||
private SubscriberType type;
|
||||
private String message;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubscriberType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(SubscriberType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
public class GeneratorData implements Data {
|
||||
|
||||
private SubscriberType type;
|
||||
private String message;
|
||||
private double m;
|
||||
private double b;
|
||||
|
||||
public double getM() {
|
||||
return m;
|
||||
}
|
||||
|
||||
public void setM(double m) {
|
||||
this.m = m;
|
||||
}
|
||||
|
||||
public double getB() {
|
||||
return b;
|
||||
}
|
||||
|
||||
public void setB(double b) {
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubscriberType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(SubscriberType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
public class ImportData implements Data {
|
||||
|
||||
private SubscriberType type;
|
||||
private int numberOfLines;
|
||||
private int current;
|
||||
|
||||
@Override
|
||||
public SubscriberType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(SubscriberType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getNumberOfLines() {
|
||||
return numberOfLines;
|
||||
}
|
||||
|
||||
public void setNumberOfLines(int numberOfLines) {
|
||||
this.numberOfLines = numberOfLines;
|
||||
}
|
||||
|
||||
public int getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(int current) {
|
||||
this.current = current;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
public enum SubscriberType {
|
||||
|
||||
EVALUATE_DATASET_GENERATED,
|
||||
EVAL_D,
|
||||
EVAL_DS,
|
||||
EVAL_T,
|
||||
LINES_RES,
|
||||
LINES_RES_MULT,
|
||||
LMS,
|
||||
RM,
|
||||
TS,
|
||||
IMPORT,
|
||||
PICTURE,
|
||||
EXPORT,
|
||||
GENERATOR
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package de.wwwu.awolf.model.communication;
|
||||
|
||||
public class TypeData implements Data {
|
||||
private SubscriberType type;
|
||||
|
||||
@Override
|
||||
public SubscriberType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(SubscriberType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
package de.wwwu.awolf.presenter;
|
||||
|
||||
import de.wwwu.awolf.model.LineModel;
|
||||
import de.wwwu.awolf.model.communication.Data;
|
||||
import de.wwwu.awolf.presenter.evaluation.EvaluateAlgorithms;
|
||||
import de.wwwu.awolf.presenter.util.IntersectionComputer;
|
||||
import de.wwwu.awolf.presenter.util.Logging;
|
||||
import de.wwwu.awolf.view.MainFrame;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Flow;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
||||
*
|
||||
* @Author: Armin Wolf
|
||||
* @Email: a_wolf28@uni-muenster.de
|
||||
* @Date: 10.09.2017.
|
||||
*/
|
||||
public abstract class AbstractPresenter implements Flow.Subscriber<Data> {
|
||||
|
||||
private final ExecutorService executor;
|
||||
private LineModel model;
|
||||
private MainFrame view;
|
||||
private EvaluateAlgorithms eval;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
*
|
||||
* @param model Modell
|
||||
* @param view View
|
||||
*/
|
||||
public AbstractPresenter(LineModel model, MainFrame view) {
|
||||
this.model = model;
|
||||
this.view = view;
|
||||
executor = Executors.newCachedThreadPool();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Flow.Subscription subscription) {
|
||||
Logging.logInfo("New Subscription: " + subscription.toString());
|
||||
subscription.request(15);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onNext(Data data) {
|
||||
switch (data.getType()) {
|
||||
case EVAL_D:
|
||||
evaluatedData(data);
|
||||
break;
|
||||
case EVAL_DS:
|
||||
evaluatedDatas(data);
|
||||
break;
|
||||
case EVAL_T:
|
||||
evaluatedTypes(data);
|
||||
break;
|
||||
case LINES_RES:
|
||||
visualizeResults(data);
|
||||
break;
|
||||
case LINES_RES_MULT:
|
||||
visualizeMultipleData(data);
|
||||
break;
|
||||
case LMS:
|
||||
visualizeLmsAlgorithm(data);
|
||||
break;
|
||||
case RM:
|
||||
visualizeRmAlgorithm(data);
|
||||
break;
|
||||
case TS:
|
||||
visualizeTsAlgorithm(data);
|
||||
break;
|
||||
case IMPORT:
|
||||
handleImport(data);
|
||||
break;
|
||||
case EXPORT:
|
||||
handleExport(data);
|
||||
break;
|
||||
case GENERATOR:
|
||||
Logging.logInfo("Generierung war Erfolgreich");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void handleExport(Data data);
|
||||
|
||||
protected abstract void handleImport(Data data);
|
||||
|
||||
protected abstract void visualizeTsAlgorithm(Data data);
|
||||
|
||||
protected abstract void visualizeRmAlgorithm(Data data);
|
||||
|
||||
protected abstract void visualizeLmsAlgorithm(Data data);
|
||||
|
||||
protected abstract void visualizeMultipleData(Data data);
|
||||
|
||||
protected abstract void visualizeResults(Data data);
|
||||
|
||||
protected abstract void evaluatedTypes(Data data);
|
||||
|
||||
protected abstract void evaluatedDatas(Data data);
|
||||
|
||||
protected abstract void evaluatedData(Data data);
|
||||
|
||||
@Override
|
||||
public void onError(Throwable throwable) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Startet das parallele Berechnen der Schnittpunkte der Geraden die im Modell enthalten sind.
|
||||
*/
|
||||
private void startIntersectionCalculation() {
|
||||
getExecutor().submit(() -> {
|
||||
getModel().resetRanges();
|
||||
IntersectionComputer intersectionComputer = new IntersectionComputer(getModel().getLines());
|
||||
getModel().setNodes(intersectionComputer.compute());
|
||||
|
||||
getModel().setxMaximum(intersectionComputer.getxMaximum());
|
||||
getModel().setxMinimum(intersectionComputer.getxMinimum());
|
||||
getModel().setyMaximum(intersectionComputer.getyMaximum());
|
||||
getModel().setyMinimum(intersectionComputer.getyMinimum());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper Methode die das berechnen der Schnittpunkte anstößt und die Ergebnisse(Anzahl der Schnittpunkte)
|
||||
* visuell darstellt.
|
||||
*/
|
||||
protected void computeIntersections() {
|
||||
getExecutor().submit(() -> {
|
||||
long start, end;
|
||||
start = System.currentTimeMillis();
|
||||
startIntersectionCalculation();
|
||||
end = System.currentTimeMillis();
|
||||
Logging.logInfo("Zeit: " + (end - start) / 1000);
|
||||
});
|
||||
|
||||
//darstellung der Ergebnisse
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().enableFunctionality();
|
||||
getView().getProgressDialog().dispose();
|
||||
});
|
||||
|
||||
Logging.logInfo("Informationen zu dem aktuellen Modell");
|
||||
Logging.logInfo("Anzahl der Geraden: " + getModel().getLines().size() + ".");
|
||||
Logging.logInfo("Anzahl der Schnittpunkte: " + getModel().getNodes().size() + ".");
|
||||
Logging.logInfo("Import war Erfolgreich!");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return das zu grunde legende Modell
|
||||
*/
|
||||
public LineModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param model das zu grunde legende Modell
|
||||
*/
|
||||
public void setModel(LineModel model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return die zu grunde legende View
|
||||
*/
|
||||
public MainFrame getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param view die zu grunde legende View
|
||||
*/
|
||||
public void setView(MainFrame view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Evaluation
|
||||
*/
|
||||
public EvaluateAlgorithms getEval() {
|
||||
return eval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param eval Evaluation
|
||||
*/
|
||||
public void setEval(EvaluateAlgorithms eval) {
|
||||
this.eval = eval;
|
||||
}
|
||||
|
||||
public ExecutorService getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package presenter.util;
|
||||
package de.wwwu.awolf.presenter.util;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
@ -1,6 +1,6 @@
|
||||
package presenter.util.Comparators;
|
||||
package de.wwwu.awolf.presenter.util.Comparators;
|
||||
|
||||
import model.Line;
|
||||
import de.wwwu.awolf.model.Line;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package presenter.util.Comparators;
|
||||
package de.wwwu.awolf.presenter.util.Comparators;
|
||||
|
||||
import model.Line;
|
||||
import de.wwwu.awolf.model.Line;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
@ -0,0 +1,40 @@
|
||||
package de.wwwu.awolf.presenter.util;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class Logging {
|
||||
private static Logger logger = Logger.getRootLogger();
|
||||
|
||||
public static void logInfo(final String message, Throwable throwable) {
|
||||
logger.info(message, throwable);
|
||||
}
|
||||
|
||||
public static void logInfo(final String message) {
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
public static void logDebug(final String message, Throwable throwable) {
|
||||
logger.debug(message, throwable);
|
||||
}
|
||||
|
||||
public static void logDebug(final String message) {
|
||||
logger.debug(message);
|
||||
}
|
||||
|
||||
public static void logWarning(final String message, Throwable throwable) {
|
||||
logger.warn(message, throwable);
|
||||
}
|
||||
|
||||
public static void logWarning(final String message) {
|
||||
logger.warn(message);
|
||||
}
|
||||
|
||||
public static void logError(final String message, Throwable throwable) {
|
||||
logger.error(message, throwable);
|
||||
}
|
||||
|
||||
public static void logError(final String message) {
|
||||
logger.error(message);
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package view;
|
||||
|
||||
import presenter.Presenter;
|
||||
import view.listener.ExportDataListener;
|
||||
import view.listener.GenerateDataListener;
|
||||
import view.listener.ImportDataListener;
|
||||
import view.listener.PictureImportListener;
|
||||
import view.panels.AboutPanel;
|
||||
package de.wwwu.awolf.view;
|
||||
|
||||
import de.wwwu.awolf.presenter.Presenter;
|
||||
import de.wwwu.awolf.view.listener.ExportDataListener;
|
||||
import de.wwwu.awolf.view.listener.GenerateDataListener;
|
||||
import de.wwwu.awolf.view.listener.ImportDataListener;
|
||||
import de.wwwu.awolf.view.listener.PictureImportListener;
|
||||
import de.wwwu.awolf.view.panels.AboutPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package view.custom;
|
||||
package de.wwwu.awolf.view.custom;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.HashSet;
|
@ -1,4 +1,4 @@
|
||||
package view.custom;
|
||||
package de.wwwu.awolf.view.custom;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
@ -1,6 +1,6 @@
|
||||
package view.listener;
|
||||
package de.wwwu.awolf.view.listener;
|
||||
|
||||
import presenter.Presenter;
|
||||
import de.wwwu.awolf.presenter.Presenter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
@ -1,6 +1,6 @@
|
||||
package view.listener;
|
||||
package de.wwwu.awolf.view.listener;
|
||||
|
||||
import presenter.Presenter;
|
||||
import de.wwwu.awolf.presenter.Presenter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
@ -1,10 +1,10 @@
|
||||
package view.listener;
|
||||
package de.wwwu.awolf.view.listener;
|
||||
|
||||
import presenter.Presenter;
|
||||
import view.panels.tabs.LMSPanel;
|
||||
import view.panels.tabs.RMPanel;
|
||||
import view.panels.tabs.TSPanel;
|
||||
import view.panels.tabs.TabPanel;
|
||||
import de.wwwu.awolf.presenter.Presenter;
|
||||
import de.wwwu.awolf.view.panels.tabs.LMSPanel;
|
||||
import de.wwwu.awolf.view.panels.tabs.RMPanel;
|
||||
import de.wwwu.awolf.view.panels.tabs.TSPanel;
|
||||
import de.wwwu.awolf.view.panels.tabs.TabPanel;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
@ -1,4 +1,4 @@
|
||||
package view.panels;
|
||||
package de.wwwu.awolf.view.panels;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.TitledBorder;
|
@ -1,4 +1,4 @@
|
||||
package view.panels.tabs;
|
||||
package de.wwwu.awolf.view.panels.tabs;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
@ -1,4 +1,4 @@
|
||||
package view.panels.tabs;
|
||||
package de.wwwu.awolf.view.panels.tabs;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
@ -1,4 +1,4 @@
|
||||
package view.panels.tabs;
|
||||
package de.wwwu.awolf.view.panels.tabs;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
@ -1,6 +1,6 @@
|
||||
package view.panels.tabs;
|
||||
package de.wwwu.awolf.view.panels.tabs;
|
||||
|
||||
import view.panels.PlotPanel;
|
||||
import de.wwwu.awolf.view.panels.PlotPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.TitledBorder;
|
@ -1,216 +0,0 @@
|
||||
package presenter;
|
||||
|
||||
import model.LineModel;
|
||||
import presenter.evaluation.EvaluateAlgorithms;
|
||||
import presenter.util.IntersectionComputer;
|
||||
import view.MainFrame;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
||||
*
|
||||
* @Author: Armin Wolf
|
||||
* @Email: a_wolf28@uni-muenster.de
|
||||
* @Date: 10.09.2017.
|
||||
*/
|
||||
public abstract class AbstractPresenter implements Observer {
|
||||
|
||||
private final ExecutorService executor;
|
||||
private LineModel model;
|
||||
private MainFrame view;
|
||||
private EvaluateAlgorithms eval;
|
||||
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
*
|
||||
* @param model Modell
|
||||
* @param view View
|
||||
*/
|
||||
public AbstractPresenter(LineModel model, MainFrame view) {
|
||||
this.model = model;
|
||||
this.view = view;
|
||||
executor = Executors.newCachedThreadPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
String[] result = ((String[]) arg);
|
||||
String observable = result[0];
|
||||
|
||||
switch (observable) {
|
||||
case "eval-dataset-generated":
|
||||
SwingUtilities.invokeLater(() -> getView().addEvalDataset(getEval().getData()));
|
||||
break;
|
||||
case "eval-d":
|
||||
SwingUtilities.invokeLater(() -> getView().appendEvalResult(result, Integer.parseInt(result[1]), false));
|
||||
break;
|
||||
case "eval-ds":
|
||||
SwingUtilities.invokeLater(() -> getView().appendEvalResult(result));
|
||||
break;
|
||||
case "eval-t":
|
||||
SwingUtilities.invokeLater(() -> getView().appendEvalResult(result, Integer.parseInt(result[1]), true));
|
||||
break;
|
||||
case "lines-res":
|
||||
SwingUtilities.invokeLater(() -> getView().drawLineResult(result, Integer.parseInt(result[1])));
|
||||
break;
|
||||
case "lines-res-mult":
|
||||
SwingUtilities.invokeLater(() -> getView().drawLineResults(result));
|
||||
break;
|
||||
case "lms":
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().visualizeLMS(Double.parseDouble(result[1]), Double.parseDouble(result[2]));
|
||||
//getView().setLmsIsComplete(true);
|
||||
getView().logHeading("Least Median of Squares");
|
||||
getView().log("<b>m:</b> " + result[1]);
|
||||
getView().log("<b>b:</b> " + result[2]);
|
||||
getView().logSuccess("Berechnung wurde Erfolgreich durchgeführt <hr>");
|
||||
});
|
||||
break;
|
||||
case "rm":
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().visualizeRM(Double.parseDouble(result[1]), Double.parseDouble(result[2]));
|
||||
getView().logHeading("Repeated Median Estimator");
|
||||
getView().log("<b>m:</b> " + result[1]);
|
||||
getView().log("<b>b:</b> " + result[2]);
|
||||
getView().logSuccess("Berechnung wurde Erfolgreich durchgeführt <hr>");
|
||||
});
|
||||
break;
|
||||
case "ts":
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().visualizeTS(Double.parseDouble(result[1]), Double.parseDouble(result[2]));
|
||||
getView().logHeading("Theil-Sen Estimator");
|
||||
getView().log("<b>m:</b> " + result[1]);
|
||||
getView().log("<b>b:</b> " + result[2]);
|
||||
getView().logSuccess("Berechnung wurde Erfolgreich durchgeführt <hr>");
|
||||
});
|
||||
break;
|
||||
case "import":
|
||||
Double max = Double.parseDouble(result[1]);
|
||||
Double current = Double.parseDouble(result[2]);
|
||||
Integer progress = (int) (100 * (current / max));
|
||||
//100% erreicht
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().showImportProgress(progress);
|
||||
});
|
||||
break;
|
||||
case "export":
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().logHeading("Export der Daten als CSV");
|
||||
getView().logSuccess("Export war Erfolgreich");
|
||||
getView().log(result[1] + "<hr>");
|
||||
});
|
||||
break;
|
||||
case "generator":
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().logSuccess("Generierung war Erfolgreich");
|
||||
getView().log(result[1] + "<hr>");
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Startet das parallele Berechnen der Schnittpunkte der Geraden die im Modell enthalten sind.
|
||||
*/
|
||||
private void startIntersectionCalculation() {
|
||||
try {
|
||||
Thread thread = new Thread(() -> {
|
||||
getModel().resetRanges();
|
||||
IntersectionComputer intersectionComputer = new IntersectionComputer(getModel().getLines());
|
||||
getModel().setNodes(intersectionComputer.compute());
|
||||
|
||||
getModel().setxMaximum(intersectionComputer.getxMaximum());
|
||||
getModel().setxMinimum(intersectionComputer.getxMinimum());
|
||||
getModel().setyMaximum(intersectionComputer.getyMaximum());
|
||||
getModel().setyMinimum(intersectionComputer.getyMinimum());
|
||||
});
|
||||
thread.start();
|
||||
thread.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper Methode die das berechnen der Schnittpunkte anstößt und die Ergebnisse(Anzahl der Schnittpunkte)
|
||||
* visuell darstellt.
|
||||
*/
|
||||
protected void computeIntersections() {
|
||||
Thread t = new Thread(() -> {
|
||||
long start, end;
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
startIntersectionCalculation();
|
||||
end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("Zeit: " + (end - start) / 1000);
|
||||
});
|
||||
t.start();
|
||||
try {
|
||||
t.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//darstellung der Ergebnisse
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
getView().enableFunctionality();
|
||||
getView().getProgressDialog().dispose();
|
||||
getView().logHeading("Informationen zu dem aktuellen Modell");
|
||||
getView().log("Anzahl der Geraden: " + getModel().getLines().size() + ".");
|
||||
getView().log("Anzahl der Schnittpunkte: " + getModel().getNodes().size() + ".");
|
||||
getView().logSuccess("Import war Erfolgreich! <hr>");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return das zu grunde legende Modell
|
||||
*/
|
||||
public LineModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param model das zu grunde legende Modell
|
||||
*/
|
||||
public void setModel(LineModel model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return die zu grunde legende View
|
||||
*/
|
||||
public MainFrame getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param view die zu grunde legende View
|
||||
*/
|
||||
public void setView(MainFrame view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Evaluation
|
||||
*/
|
||||
public EvaluateAlgorithms getEval() {
|
||||
return eval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param eval Evaluation
|
||||
*/
|
||||
public void setEval(EvaluateAlgorithms eval) {
|
||||
this.eval = eval;
|
||||
}
|
||||
|
||||
public ExecutorService getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
package presenter.io;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
||||
*
|
||||
* @Author: Armin Wolf
|
||||
* @Email: a_wolf28@uni-muenster.de
|
||||
* @Date: 08.09.2017.
|
||||
*/
|
||||
public class EvalResultLatexExport {
|
||||
|
||||
private DefaultTableModel model;
|
||||
private File file;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
*
|
||||
* @param model TableModel aus dem exportiert werden soll
|
||||
* @param file Datei in die exportiert werden soll
|
||||
*/
|
||||
public EvalResultLatexExport(DefaultTableModel model, File file) {
|
||||
this.model = model;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quelle: <url>https://en.wikibooks.org/wiki/LaTeX/Tables</url>
|
||||
* \begin{tabular}{l*{3}{c}}
|
||||
* Team & P & W & D & L & F & A & Pts \\\hline
|
||||
* Manchester United & 6 & 4 & 0 & 2 & 10 & 5 & 12 \\
|
||||
* Celtic & 6 & 3 & 0 & 3 & 8 & 9 & 9 \\
|
||||
* Benfica & 6 & 2 & 1 & 3 & 7 & 8 & 7 \\
|
||||
* FC Copenhagen & 6 & 2 & 1 & 3 & 5 & 8 & 7 \\
|
||||
* \end{tabular}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String createOutputData() {
|
||||
String split = "&";
|
||||
StringBuilder doc = new StringBuilder();
|
||||
doc.append("\\begin{tabular}{|l|r|r|r|}" + "\\hline\r\n");
|
||||
for (int i = 0; i < model.getColumnCount(); i++) {
|
||||
if (model.getValueAt(0, i).toString() != "" || model.getRowCount() > 5)
|
||||
doc.append("\\textsc{" + model.getColumnName(i) + "}" + split);
|
||||
}
|
||||
|
||||
doc.deleteCharAt(doc.lastIndexOf(split));
|
||||
doc.append("\\\\\\hline" + "\r\n");
|
||||
|
||||
for (int i = 0; i < model.getRowCount() - 1; i++) {
|
||||
for (int j = 0; j < model.getColumnCount(); j++) {
|
||||
if (model.getValueAt(i, j).toString() != "") {
|
||||
if (j == 0) {
|
||||
doc.append("\\textbf{" + model.getValueAt(i, j).toString() + "}" + split);
|
||||
} else {
|
||||
Double val = Double.parseDouble((String) model.getValueAt(i, j));
|
||||
doc.append(String.format("%.3f", val) + split);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (model.getValueAt(i, 0) != "") {
|
||||
doc.deleteCharAt(doc.lastIndexOf(split));
|
||||
}
|
||||
doc.append("\\\\\\hline" + "\r\n");
|
||||
}
|
||||
doc.append("\\end{tabular}");
|
||||
return doc.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* das schreiben der Informationen über den Stream in die Datei
|
||||
*/
|
||||
public void writeFile() {
|
||||
FileWriter fileWriter = null;
|
||||
BufferedWriter bufferedWriter = null;
|
||||
try {
|
||||
fileWriter = new FileWriter(file);
|
||||
bufferedWriter = new BufferedWriter(fileWriter);
|
||||
bufferedWriter.write(createOutputData());
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null, "Export war Erfolgreich!");
|
||||
});
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
bufferedWriter.close();
|
||||
fileWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
# Root logger option
|
||||
log4j.rootLogger=INFO, file, stdout
|
||||
# Direct log messages to a log file
|
||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.file.File=D:\\Git\\master-implementierung\\LinearRegressionTool\\log4j\\app.log
|
||||
log4j.appender.file.MaxFileSize=10MB
|
||||
log4j.appender.file.MaxBackupIndex=10
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
# Direct log messages to stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
@ -1,8 +1,8 @@
|
||||
package presenter.util;
|
||||
package de.wwwu.awolf.presenter.util;
|
||||
|
||||
import model.Interval;
|
||||
import model.Line;
|
||||
import model.LineModel;
|
||||
import de.wwwu.awolf.model.Interval;
|
||||
import de.wwwu.awolf.model.Line;
|
||||
import de.wwwu.awolf.model.LineModel;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
Loading…
Reference in new issue