package dr.inference.trace;

/**
 * @author Alexei Drummond
 * @author Walter Xie
 */
public class TraceFactory {

    public enum TraceType {
        CONTINUOUS("real", "R", Double.class),
        INTEGER("integer", "I", Integer.class),
        CATEGORY("category", "C", String.class);

        TraceType(String name, String brief, Class type) {
            this.name = name;
            this.brief = brief;
            this.type = type;
        }

        public String toString() {
            return name;
        }

        public String getBrief() {
            return brief;
        }

        public Class getType() {
            return type;
        }

        private final String name;
        private final String brief;
        private final Class type;
    }

    public static Trace createTrace(TraceType traceType, String name, int initialSize) {

//        Double[] d = new Double[10];
//        Double[] t = new Double[10];
//        System.arraycopy(d, 0, t, 0, d.length);

        System.out.println("create trace (" + name + ") with type " + traceType);
        
        switch (traceType) {
            case CONTINUOUS:
                return new Trace<Double>(name, initialSize, Double.valueOf(0));
            case INTEGER:
                return new Trace<Integer>(name, initialSize, Integer.valueOf(0));
            case CATEGORY:
                return new Trace<String>(name, initialSize, "initial_value");
        }
        throw new IllegalArgumentException("The trace type " + traceType + " is not recognized.");
    }

}


@@ -1031,24 +1031,27 @@
 ;%0D%0A%0D%0A       
+ //
  System.out.
@@ -1248,25 +1248,18 @@
 ze, 
-D
+(d
 ouble
-.valueOf(0)
+) 0
 );%0D%0A
@@ -1350,26 +1350,9 @@
 ze, 
-Integer.valueOf(0)
+0
 );%0D%0A

Remove annoying debug print