From 4401414b6702cf8af961422c4ad702479a83dc2e Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Tue, 4 Nov 2014 13:47:31 +0100 Subject: [PATCH] =?UTF-8?q?Anderen=20Logger=20angef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logger/LoggerConfiguration.java | 29 ++++++++++++ .../dhbwstuttgart/logger/SectionLogger.java | 26 +++++++++++ .../typeinference/unify/ParallelUnify.java | 44 +++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 src/de/dhbwstuttgart/logger/LoggerConfiguration.java create mode 100644 src/de/dhbwstuttgart/logger/SectionLogger.java create mode 100644 src/de/dhbwstuttgart/typeinference/unify/ParallelUnify.java diff --git a/src/de/dhbwstuttgart/logger/LoggerConfiguration.java b/src/de/dhbwstuttgart/logger/LoggerConfiguration.java new file mode 100644 index 00000000..d9ae2c0e --- /dev/null +++ b/src/de/dhbwstuttgart/logger/LoggerConfiguration.java @@ -0,0 +1,29 @@ +package de.dhbwstuttgart.logger; + +import java.io.PrintStream; +import java.util.HashMap; + +import de.dhbwstuttgart.typeinference.exceptions.DebugException; + +public class LoggerConfiguration{ + + private final HashMap outputs = new HashMap<>(Section.values().length); + + public LoggerConfiguration setOutput(Section forSection, PrintStream output){ + if(outputs.containsKey(forSection)){ + throw new DebugException("Eine outputStream für Section "+forSection+" ist bereits vorhanden"); + } + outputs.put(forSection, output); + return this; + } + + public void forEach(ConfigurationEvaluater action){ + for(Section key : outputs.keySet()){ + action.apply(key, outputs.get(key)); + } + } +} + +interface ConfigurationEvaluater { + public void apply(Section s, PrintStream o); +} diff --git a/src/de/dhbwstuttgart/logger/SectionLogger.java b/src/de/dhbwstuttgart/logger/SectionLogger.java new file mode 100644 index 00000000..dd786328 --- /dev/null +++ b/src/de/dhbwstuttgart/logger/SectionLogger.java @@ -0,0 +1,26 @@ +package de.dhbwstuttgart.logger; + +import java.util.logging.Level; + +/** + * Sämtliche Logging Ausgaben werden in die bei der Erstellung des Loggers übergebene Section eingeteilt + * @author janulrich + * + */ +public class SectionLogger { + private Logger log; + private Section section; + protected SectionLogger(Logger logger, Section s){ + this.log = logger; + this.section = s; + } + public void debug(String message){ + log.debug(message, section); + } + public void info(String string) { + log.info(string, section); + } + public void error(String string) { + log.error(string, section); + } +} diff --git a/src/de/dhbwstuttgart/typeinference/unify/ParallelUnify.java b/src/de/dhbwstuttgart/typeinference/unify/ParallelUnify.java new file mode 100644 index 00000000..d07e4515 --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/unify/ParallelUnify.java @@ -0,0 +1,44 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.Vector; +import java.util.stream.Stream; + +import de.dhbwstuttgart.typeinference.ConstraintsSet; +import de.dhbwstuttgart.typeinference.Pair; + +public class ParallelUnify { + + public ParallelUnify(ConstraintsSet constraints){ + constraints.getConstraints(); + } + + private CartesianProduct parallelCartProd(){ + + return null; + } + + private UnifyResult parallelUnify(Vector pairs, FC_TTO fc){ + UnifyResult ret = new UnifyResult(); + return ret; + } + + public UnifyResult unify(){ + UnifyResult ret = new UnifyResult(); + return ret; + } + +} + +class ParallelConstraintSet extends ConstraintsSet{ + Stream parallelGetConstraints(){ + return null; + } +} + +class UnifyResult{ + +} + +class CartesianProduct{ + +} \ No newline at end of file