Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/org/dive4elements/river/artifacts/math/fitting/FunctionFactory.java @ 5831:bd047b71ab37
Repaired internal references
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:06:39 +0200 |
parents | flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/fitting/FunctionFactory.java@59b14bc676ec |
children |
comparison
equal
deleted
inserted
replaced
5830:160f53ee0870 | 5831:bd047b71ab37 |
---|---|
1 package org.dive4elements.river.artifacts.math.fitting; | |
2 | |
3 import java.util.Collection; | |
4 import java.util.LinkedHashMap; | |
5 import java.util.Map; | |
6 | |
7 public final class FunctionFactory | |
8 { | |
9 private static FunctionFactory instance; | |
10 | |
11 private Map<String, Function> functions; | |
12 | |
13 private FunctionFactory() { | |
14 functions = new LinkedHashMap<String, Function>(); | |
15 | |
16 registerFunction(Log.INSTANCE); | |
17 registerFunction(Linear.INSTANCE); | |
18 registerFunction(LogLinear.INSTANCE); | |
19 registerFunction(Exp.INSTANCE); | |
20 registerFunction(Quad.INSTANCE); | |
21 registerFunction(Pow.INSTANCE); | |
22 registerFunction(SQPow.INSTANCE); | |
23 } | |
24 | |
25 public static synchronized FunctionFactory getInstance() { | |
26 if (instance == null) { | |
27 instance = new FunctionFactory(); | |
28 } | |
29 return instance; | |
30 } | |
31 | |
32 public Function getFunction(String name) { | |
33 return functions.get(name); | |
34 } | |
35 | |
36 public void registerFunction(Function function) { | |
37 functions.put(function.getName(), function); | |
38 } | |
39 | |
40 public Collection<Function> getFunctions() { | |
41 return functions.values(); | |
42 } | |
43 } | |
44 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |