Statistics
| Revision:

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 15459 julio
package com.iver.cit.gvsig.animation.keyframe.interpolator;
2
3
import java.util.HashMap;
4
import java.util.Map;
5
6 15476 julio
7
/*
8
 * factoria para el registro y la creacion de funciones de animacion de tiempo
9
 *
10
 *
11
 */
12 15459 julio
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 18655 jcampos
        public static void register(IInterpolatorTimeFuntion funtion) {
27 15459 julio
                objectsList.put(funtion.getClassName(), funtion);
28
        }
29
30 18655 jcampos
        public static IInterpolatorTimeFuntion createObject(String type) {
31
                IInterpolatorTimeFuntion funtion = null;
32 15459 julio
                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 18655 jcampos
                        funtion = (IInterpolatorTimeFuntion) objectsList.get(type).getClass().newInstance();
39 15459 julio
                } catch (InstantiationException e) {
40
                        e.printStackTrace();
41
                } catch (IllegalAccessException e) {
42
                        e.printStackTrace();
43
                }
44
                return funtion;
45
        }
46
47
}