public Class enc_d_VisitorImpl2(String name, Variable[] state, Type evalType, String evaluatorClass, String evaluatorMethod, Class[] dtypes) {
        final String cname = d.get(name);
        Class c = new Class(pack,cname, cons(VISITOR));
//        Variable stateVar = new Variable(stateType, stateName);
        // field state
//        c.fields.add(stateVar);
        // constructor
//        Method cons = new Method(cname);
//        cons.params.add(stateVar);
//        cons.mBody.add(new Assignment("this."+stateVar.name, new VariableExpression(stateVar.name)));
//        c.methods.add(cons);
        // method getState
//        Method gets = new Method(stateVar.type, "get"+STATE);
//        gets.mBody.add(new Return(new VariableExpression(stateVar.name)));
//        c.methods.add(gets);
        for (Class ds : dtypes) {
//            Type nodetype = ds.superType[0];
//            Type rtype = consnat(java.lang.Object.class);
            Method m = new Method(evalType, VISIT);
            Type type = cons(ds.name);
            type.params = new Type[ds.params.size()];
            int i = 0;
            for (String ts : ds.params) {
                type.params[i++] = cons(ts);
            }
            m.params.addAll(Arrays.asList(state));
            m.params.add(new Variable(type.toRawType(), VISITORPARAM));
            IExpression[] params = new IExpression[state.length+1];
            params[0]=new VariableExpression(VISITORPARAM);
            for(int k=1;k<params.length;k++) {
                params[k]=new VariableExpression(state[k-1].name);
            }
            IExpression dtt = new Invocation(new ObjectCreation(new Type(evaluatorClass)), evaluatorMethod, params);
            m.mBody.add(new Return(dtt));
            c.methods.add(m);
        }
        return c;
    }