Property definitions

more_collections $ UnrolledNode :: defaultinit
# Node composing an `UnrolledList`
#
# Stores the elements in the `items` array. The elements in the `items` array
# begin at `head_index` and end right before `tail_index`. The data is contiguous,
# but there can be empty cells at the beginning and the end of the array.
private class UnrolledNode[E]

	var prev: nullable UnrolledNode[E] = null

	var next: nullable UnrolledNode[E] = null

	# Desired length of `items`
	var capacity: Int

	# `Array` of items in this node, filled with `null`
	var items = new Array[nullable E].filled_with(null, capacity) is lazy

	# Index of the first element in `items`
	var head_index = 0

	# Index after the last element in `items`
	var tail_index = 0

	fun length: Int do return tail_index - head_index

	fun full: Bool do return length == capacity

	fun is_empty: Bool do return tail_index == head_index

	# Move towards the head all elements before `index` of `displace` cells
	fun move_tail(index, displace: Int)
	do
		for i in [tail_index-1..head_index+index].step(-1) do
			items[i+displace] = items[i]
		end
	end

	# Move towards the tail all elements at and after `index` of `displace` cells
	fun move_head(index, displace: Int)
	do
		for i in [head_index..head_index+index[ do
			items[i-displace] = items[i]
		end
	end
end
lib/more_collections/more_collections.nit:605,1--649,3