/*------------------------------------------------------------------------------

Class: adobe.DataWheel

------------------------------------------------------------------------------*/
adobe.DataWheel = Class.create({
/*------------------------------------------------------------------------------

	Method: initialize
	
	Parameters:
	oid - string or number
	options - object
	
	Returned Value:
	Array length

------------------------------------------------------------------------------*/

	initialize: function(oid, options) {
		this.oid = oid;
		this.options = {
			range: 1	
		};
		Object.extend(this.options, options);		
		this.range = this.options.range;
		this.revolutions = 0;
		this.data = [];
	},
/*------------------------------------------------------------------------------

	Method: add
	
	Parameters:
	data - object
	
	Returned Value:
	Array length

------------------------------------------------------------------------------*/
	add: function(data) {
		return this.data.push.apply(this.data, $A(data));
	},
/*------------------------------------------------------------------------------

	Method: read
	
	Returned Value:
	Array slice

------------------------------------------------------------------------------*/
	read: function() {
		return this.data.slice(0, this.range);
	},
/*------------------------------------------------------------------------------

	Method: next
	
	Rotate the data by the range set on initialization
	
	Returned Value:
	Array slice

------------------------------------------------------------------------------*/
	next: function(times) {
		var times = times||1;
		this.data.revolve(this.range*times);
		this.revolutions = this.revolutions+times;
		return this.read();
	},
/*------------------------------------------------------------------------------

	Method: back
	
	Rotate the data by the range on initialization
	
	Returned Value:
	Array slice

------------------------------------------------------------------------------*/
	back: function(times) {
		var times = times||1;
		this.data.revolve((this.range*times)*-1);
		this.revolutions = this.revolutions-times;
		return this.read();
	}
});
