private void writeOutTypeFromTo(BytecodeContext bc) throws TransformerException {
	ForDoubleVisitor forDoubleVisitor = new ForDoubleVisitor();
	loopVisitor = forDoubleVisitor;
	GeneratorAdapter adapter = bc.getAdapter();

	// int from=(int)@from;
	int from = adapter.newLocal(Types.DOUBLE_VALUE);
	ExpressionUtil.writeOutSilent(getAttribute("from").getValue(), bc, Expression.MODE_VALUE);
	adapter.storeLocal(from);

	// int to=(int)@to;
	int to = adapter.newLocal(Types.DOUBLE_VALUE);
	ExpressionUtil.writeOutSilent(getAttribute("to").getValue(), bc, Expression.MODE_VALUE);
	adapter.storeLocal(to);

	// int step=(int)@step;
	int step = adapter.newLocal(Types.DOUBLE_VALUE);
	Attribute attrStep = getAttribute("step");
	if (attrStep != null) {
	    ExpressionUtil.writeOutSilent(attrStep.getValue(), bc, Expression.MODE_VALUE);
	}
	else {
	    adapter.push(1D);
	}
	adapter.storeLocal(step);

	// boolean dirPlus=(step > 0);
	int dirPlus = adapter.newLocal(Types.BOOLEAN_VALUE);
	DecisionDoubleVisitor div = new DecisionDoubleVisitor();
	div.visitBegin();
	adapter.loadLocal(step);
	div.visitGT();
	adapter.push(0D);
	div.visitEnd(bc);
	adapter.storeLocal(dirPlus);

	// if(step!=0) {
	div = new DecisionDoubleVisitor();
	div.visitBegin();
	adapter.loadLocal(step);
	div.visitNEQ();
	adapter.push(0D);
	div.visitEnd(bc);
	Label ifEnd = new Label();
	adapter.ifZCmp(Opcodes.IFEQ, ifEnd);

	// VariableReference index>=VariableInterpreter.getVariableReference(pc,@index));
	int index = adapter.newLocal(Types.VARIABLE_REFERENCE);
	adapter.loadArg(0);
	Attribute attr = getAttribute("index");
	if (attr == null) attr = getAttribute("item");
	ExpressionUtil.writeOutSilent(attr.getValue(), bc, Expression.MODE_REF);
	adapter.invokeStatic(Types.VARIABLE_INTERPRETER, GET_VARIABLE_REFERENCE);
	adapter.storeLocal(index);

	// index.set(from);
	adapter.loadLocal(index);
	adapter.loadLocal(from);
	adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE);

	// for

	// int i=forConditionVisitor.visitBeforeExpression(adapter,from,step,true);

	// init
	adapter.visitLabel(forDoubleVisitor.beforeInit);
	forDoubleVisitor.forInit(adapter, from, true);
	adapter.goTo(forDoubleVisitor.beforeExpr);

	// update
	adapter.visitLabel(forDoubleVisitor.beforeUpdate);
	adapter.loadLocal(index);
	// forConditionVisitor.forUpdate(adapter, step, true);
	adapter.visitVarInsn(Opcodes.DLOAD, forDoubleVisitor.i);
	adapter.loadLocal(step);
	adapter.visitInsn(Opcodes.DADD);
	adapter.visitInsn(Opcodes.DUP2);
	adapter.visitVarInsn(Opcodes.DSTORE, forDoubleVisitor.i);

	adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE);

	// expression
	adapter.visitLabel(forDoubleVisitor.beforeExpr);
	int i = forDoubleVisitor.i;

	adapter.loadLocal(dirPlus);
	Label l1 = new Label();
	adapter.visitJumpInsn(Opcodes.IFEQ, l1);

	div = new DecisionDoubleVisitor();
	div.visitBegin();
	adapter.visitVarInsn(Opcodes.DLOAD, i);
	div.visitLTE();
	adapter.loadLocal(to);
	div.visitEnd(bc);

	Label l2 = new Label();
	adapter.visitJumpInsn(Opcodes.GOTO, l2);
	adapter.visitLabel(l1);

	div = new DecisionDoubleVisitor();
	div.visitBegin();
	adapter.visitVarInsn(Opcodes.DLOAD, i);
	div.visitGTE();
	adapter.loadLocal(to);
	div.visitEnd(bc);

	adapter.visitLabel(l2);
	forDoubleVisitor.visitAfterExpressionBeginBody(adapter);

	// adapter.loadLocal(index);
	// adapter.visitVarInsn(Opcodes.DLOAD, i);
	// adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE);

	getBody().writeOut(bc);

	forDoubleVisitor.visitEndBody(bc, getEnd());

	////// set i after usage
	// adapter.loadLocal(index);
	// adapter.visitVarInsn(Opcodes.DLOAD, i);
	// adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE);

	adapter.visitLabel(ifEnd);

    }
private void writeOutTypeFromTo ( BytecodeContext bc ) throws TransformerException { ForDoubleVisitor forDoubleVisitor = new ForDoubleVisitor ( ) ; loopVisitor = forDoubleVisitor ; GeneratorAdapter adapter = bc . getAdapter ( ) ; int from = adapter . newLocal ( Types . DOUBLE_VALUE ) ; ExpressionUtil . writeOutSilent ( getAttribute ( "from" ) . getValue ( ) , bc , Expression . MODE_VALUE ) ; adapter . storeLocal ( from ) ; int to = adapter . newLocal ( Types . DOUBLE_VALUE ) ; ExpressionUtil . writeOutSilent ( getAttribute ( "to" ) . getValue ( ) , bc , Expression . MODE_VALUE ) ; adapter . storeLocal ( to ) ; int step = adapter . newLocal ( Types . DOUBLE_VALUE ) ; Attribute attrStep = getAttribute ( "step" ) ; if ( attrStep != null ) { ExpressionUtil . writeOutSilent ( attrStep . getValue ( ) , bc , Expression . MODE_VALUE ) ; } else { adapter . push ( 1D ) ; } adapter . storeLocal ( step ) ; int dirPlus = adapter . newLocal ( Types . BOOLEAN_VALUE ) ; DecisionDoubleVisitor div = new DecisionDoubleVisitor ( ) ; div . visitBegin ( ) ; adapter . loadLocal ( step ) ; div . visitGT ( ) ; adapter . push ( 0D ) ; div . visitEnd ( bc ) ; adapter . storeLocal ( dirPlus ) ; div = new DecisionDoubleVisitor ( ) ; div . visitBegin ( ) ; adapter . loadLocal ( step ) ; div . visitNEQ ( ) ; adapter . push ( 0D ) ; div . visitEnd ( bc ) ; Label ifEnd = new Label ( ) ; adapter . ifZCmp ( Opcodes . IFEQ , ifEnd ) ; int index = adapter . newLocal ( Types . VARIABLE_REFERENCE ) ; adapter . loadArg ( 0 ) ; Attribute attr = getAttribute ( "index" ) ; if ( attr == null ) attr = getAttribute ( "item" ) ; ExpressionUtil . writeOutSilent ( attr . getValue ( ) , bc , Expression . MODE_REF ) ; adapter . invokeStatic ( Types . VARIABLE_INTERPRETER , GET_VARIABLE_REFERENCE ) ; adapter . storeLocal ( index ) ; adapter . loadLocal ( index ) ; adapter . loadLocal ( from ) ; adapter . invokeVirtual ( Types . VARIABLE_REFERENCE , SET_DOUBLE ) ; adapter . visitLabel ( forDoubleVisitor . beforeInit ) ; forDoubleVisitor . forInit ( adapter , from , true ) ; adapter . goTo ( forDoubleVisitor . beforeExpr ) ; adapter . visitLabel ( forDoubleVisitor . beforeUpdate ) ; adapter . loadLocal ( index ) ; adapter . visitVarInsn ( Opcodes . DLOAD , forDoubleVisitor . i ) ; adapter . loadLocal ( step ) ; adapter . visitInsn ( Opcodes . DADD ) ; adapter . visitInsn ( Opcodes . DUP2 ) ; adapter . visitVarInsn ( Opcodes . DSTORE , forDoubleVisitor . i ) ; adapter . invokeVirtual ( Types . VARIABLE_REFERENCE , SET_DOUBLE ) ; adapter . visitLabel ( forDoubleVisitor . beforeExpr ) ; int i = forDoubleVisitor . i ; adapter . loadLocal ( dirPlus ) ; Label l1 = new Label ( ) ; adapter . visitJumpInsn ( Opcodes . IFEQ , l1 ) ; div = new DecisionDoubleVisitor ( ) ; div . visitBegin ( ) ; adapter . visitVarInsn ( Opcodes . DLOAD , i ) ; div . visitLTE ( ) ; adapter . loadLocal ( to ) ; div . visitEnd ( bc ) ; Label l2 = new Label ( ) ; adapter . visitJumpInsn ( Opcodes . GOTO , l2 ) ; adapter . visitLabel ( l1 ) ; div = new DecisionDoubleVisitor ( ) ; div . visitBegin ( ) ; adapter . visitVarInsn ( Opcodes . DLOAD , i ) ; div . visitGTE ( ) ; adapter . loadLocal ( to ) ; div . visitEnd ( bc ) ; adapter . visitLabel ( l2 ) ; forDoubleVisitor . visitAfterExpressionBeginBody ( adapter ) ; getBody ( ) . writeOut ( bc ) ; forDoubleVisitor . visitEndBody ( bc , getEnd ( ) ) ; adapter . visitLabel ( ifEnd ) ; }
write out index loop

@param adapter
@throws TemplateException