local n={}function n.isDescendant(W,l)if not l then return function(l,X)return n.isDescendant(l,W)end end local X=W.parent while X do if X==l then return true end X=X.parent end return false end function n.isAtomic(n)return n.type=="\097\116\111\109\105\099"end function n.isCompound(n)return n.type=="\099\111\109\112\111\117\110\100"end function n.isHistory(n)return n.type=="\104\105\115\116\111\114\121"end function n.isParallel(n)return n.type=="\112\097\114\097\108\108\101\108"end return n
local check = {}

function check.isDescendant(state1, state2)
	if not state2 then
		return function(item, index)
			return check.isDescendant(item, state1)
		end
	end

	local parent = state1.parent

	while parent do
		if parent == state2 then
			return true
		end
		parent = parent.parent
	end

	return false
end

function check.isAtomic(state)
	return state.type == "atomic"
end
function check.isCompound(state)
	return state.type == "compound"
end
function check.isHistory(state)
	return state.type == "history"
end
function check.isParallel(state)
	return state.type == "parallel"
end

return check
