Code example for PriorityQueue

Methods: add

0
	 
	private void setOrigin(int pX, int pY) {
		PathElement elem = m_field[pX][pY];
		elem.m_cost = manhattanCost(pX, pY);
		elem.m_parent = null;
		m_openQueue.add(elem);
	} 
	 
	private void setTarget(int pX, int pY) {
		m_targetX = pX;
		m_targetY = pY;
	} 
	 
	private int manhattanCost(int pX, int pY) {
		return Math.abs(pX - m_targetX) + Math.abs(pY - m_targetY);
	} 
	 
	private void possiblyAddElement(PathElement elem, PathElement parent) {
		if (elem.m_closed) {
			return; 
		}