local X={}X.ClassName="\081\117\101\117\101"X.__index=X function X.new()return setmetatable({_first=0;_last=-1},X)end function X.PushLeft(I,X)I._first=I._first-1 I[I._first]=X end function X.PushRight(I,X)I._last=I._last+1 I[I._last]=X end function X.PopLeft(X)if X._first>X._last then error("\081\117\101\117\101 \105\115 \101\109\112\116\121")end local I=X[X._first]X[X._first]=nil X._first=X._first+1 return I end function X.PopRight(X)if X._first>X._last then error("\081\117\101\117\101 \105\115 \101\109\112\116\121")end local I=X[X._last]X[X._last]=nil X._last=X._last-1 return I end function X.IsEmpty(X)return X._first>X._last end function X.GetCount(X)local I=X._last-X._first if I<0 then return 0 else return I end end return X
--[=[
	Private queue class for loading system.

	@private
	@class Queue
]=]

local Queue = {}
Queue.ClassName = "Queue"
Queue.__index = Queue

--[=[
	Constructs a new queue
	@return Queue<T>
]=]
function Queue.new()
	return setmetatable({
		_first = 0;
		_last = -1;
	}, Queue)
end

--[=[
	Pushes an entry to the left of the queue
	@param value T
]=]
function Queue:PushLeft(value)
	self._first = self._first - 1
	self[self._first] = value
end

--[=[
	Pushes an entry to the right of the queue
	@param value T
]=]
function Queue:PushRight(value)
	self._last = self._last + 1
	self[self._last] = value
end

--[=[
	Pops an entry from the left of the queue
	@return T
]=]
function Queue:PopLeft()
	if self._first > self._last then
		error("Queue is empty")
	end

	local value = self[self._first]
	self[self._first] = nil
	self._first = self._first + 1

	return value
end

--[=[
	Pops an entry from the right of the queue
	@return T
]=]
function Queue:PopRight()
	if self._first > self._last then
		error("Queue is empty")
	end

	local value = self[self._last]
	self[self._last] = nil
	self._last = self._last - 1

	return value
end

--[=[
	Returns true if the queue is empty
	@return boolean
]=]
function Queue:IsEmpty()
	return self._first > self._last
end

function Queue:GetCount()
	local count = self._last - self._first
	if count < 0 then
		return 0
	else
		return count
	end
end

return Queue