svn-gvsig-desktop / trunk / libraries / libAnimation / src / com / iver / cit / gvsig / animation / keyframe / interpolator / FuntionFactory.java @ 18655
History | View | Annotate | Download (1.32 KB)
1 |
package com.iver.cit.gvsig.animation.keyframe.interpolator; |
---|---|
2 |
|
3 |
import java.util.HashMap; |
4 |
import java.util.Map; |
5 |
|
6 |
|
7 |
/*
|
8 |
* factoria para el registro y la creacion de funciones de animacion de tiempo
|
9 |
*
|
10 |
*
|
11 |
*/
|
12 |
public class FuntionFactory { |
13 |
|
14 |
// private static Map<String, IInterpolatorFuntion> objectsList;
|
15 |
private static Map objectsList; |
16 |
|
17 |
static {
|
18 |
// objectsList = new HashMap<String, IInterpolatorFuntion>();
|
19 |
objectsList = new HashMap(); |
20 |
LinearFuntion lf = new LinearFuntion();
|
21 |
lf.setName("LinearFuntion");
|
22 |
lf.setDescription("Funcion para el tiempo lineal");
|
23 |
FuntionFactory.register(lf); |
24 |
} |
25 |
|
26 |
public static void register(IInterpolatorTimeFuntion funtion) { |
27 |
objectsList.put(funtion.getClassName(), funtion); |
28 |
} |
29 |
|
30 |
public static IInterpolatorTimeFuntion createObject(String type) { |
31 |
IInterpolatorTimeFuntion funtion = null;
|
32 |
try {
|
33 |
System.out.println("existe el tipo " + type + " " |
34 |
+ objectsList.containsKey(type)); |
35 |
if ((objectsList.containsKey(type)) == false) |
36 |
return null; |
37 |
// funtion = objectsList.get(type).getClass().newInstance();
|
38 |
funtion = (IInterpolatorTimeFuntion) objectsList.get(type).getClass().newInstance(); |
39 |
} catch (InstantiationException e) { |
40 |
e.printStackTrace(); |
41 |
} catch (IllegalAccessException e) { |
42 |
e.printStackTrace(); |
43 |
} |
44 |
return funtion;
|
45 |
} |
46 |
|
47 |
} |