Property definitions

dom $ XMLEntities :: defaultinit
# Proxy collection of XMLEntities, ordered, used for the children of an entity
private class XMLEntities
	super Sequence[XMLEntity]

	# The owner, aka, the parent
	var owner: XMLEntity

	var entities = new List[XMLEntity]

	redef fun length do return entities.length

	redef fun [](i) do return entities[i]

	redef fun []=(index, el) do
		var olde = self[index]
		var olde_parent = olde.parent
		if olde_parent != null then
			olde_parent.children.remove(el)
		end
		entities[index] = el
		el.set_parent owner
	end

	redef fun push(e) do
		if not entities.has(e) then
			entities.add e
			e.parent = owner
		end
	end


	redef fun remove(e) do
		if e isa XMLEntity then
			e.set_parent null
			entities.remove(e)
		end
	end

	redef fun has(e) do return entities.has(e)

	redef fun iterator do return entities.iterator

	redef fun reverse_iterator do return entities.reverse_iterator

	redef fun pop do
		var e = entities.pop
		e.set_parent null
		return e
	end

	redef fun unshift(e) do
		entities.unshift e
		e.set_parent owner
	end

	redef fun shift do
		var e = entities.shift
		e.set_parent null
		return e
	end

	redef fun insert(it, index) do
		entities.insert(it, index)
		it.set_parent owner
	end

	redef fun remove_at(ind) do
		var el = entities[ind]
		entities.remove_at(ind)
		el.set_parent null
	end
end
lib/dom/xml_entities.nit:57,1--128,3