package com.veil.adl.function;

import java.util.ArrayList;
import java.util.List;

import adl_2daa.IFunction;
import adl_2daa.SequenceInterpreter;

import com.veil.adl.literal.Direction;

public class DirectionSetRange implements IFunction {

	@Override
	public Object invoke(SequenceInterpreter itp, Object... param) {
		Direction start = Direction.parse(param[0]);
		Direction end = Direction.parse(param[1]);
		float angStart = start.getDegree();
		float angEnd = end.getDegree();
		if(angEnd < angStart){
			Direction temp = end;
			end = start;
			start = temp;
			angStart = start.getDegree();
			angEnd = end.getDegree();
		}
		float step = ((Number)param[2]).floatValue();
		List<Direction> dSet = new ArrayList<Direction>();
		while(start.getDegree() <= end.getDegree()){
			dSet.add(new Direction(start));
			start.rotate(step);
		}
		return dSet;
	}

}

@@ -510,123 +510,24 @@
 %0A%09%09%09
-Direction temp = end;%0A%09%09%09end = start;%0A%09%09%09start = temp;%0A%09%09%09angStart = start.getDegree();%0A%09%09%09angEnd = end.getDegree()
+angStart -= 360f
 ;%0A%09%09
@@ -641,44 +641,26 @@
 ile(
-start.getDegree() %3C= end.getDegree()
+angStart %3C= angEnd
 )%7B%0A%09
@@ -670,20 +670,16 @@
 Set.add(
-new 
 Directio
@@ -683,39 +683,49 @@
 tion
-(start));%0A%09%09%09start.rotate(
+.parse(%22%22+angStart));%0A%09%09%09angStart += 
 step
-)
 ;%0A%09%09

Fix DirectionSetRange not support negative rotation