Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Javadocs

  • Loading branch information...
commit a8b1e106500f2dfc6ec985393e9c801615b9babb 1 parent 2b768d7
shoebox authored
Showing with 64 additions and 21 deletions.
  1. +64 −21 src/org/shoebox/collections/PriorityQueue.hx
View
85 src/org/shoebox/collections/PriorityQueue.hx
@@ -1,7 +1,38 @@
+/**
+* HomeMade by shoe[box]
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+* Redistributions of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* Neither the name of shoe[box] nor the names of its
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
package org.shoebox.collections;
/**
- * ...
+ * Priority Queue
+ * Queue sort by priority
+ *
* @author shoe[box]
*/
@@ -29,10 +60,12 @@ class PriorityQueue<T>{
// -------o public
/**
- *
+ * Add a value to the <code>PriorityQueue</code>
*
* @public
- * @return void
+ * @param value : Value to add ( T )
+ * @param priority : Priority of the value in to the queue ( Int )
+ * @return Void
*/
public function add( value : T , ?prio : Int = 0 ) : Void {
@@ -43,10 +76,12 @@ class PriorityQueue<T>{
}
/**
- *
+ * Remove a value from the <code>PriorityQueue</code>
*
* @public
- * @return void
+ * @param value : Value to remove ( T )
+ * @param priority : Priority of the value ( Int )
+ * @return success of the removal ( Bool )
*/
public function remove( value : T , prio : Int = -1 ) : Bool {
@@ -64,10 +99,12 @@ class PriorityQueue<T>{
}
/**
- *
+ * Test if the <code>PriorityQueue</code> contains the the value at the priority N.
*
* @public
- * @return void
+ * @value value : value to test ( T )
+ * @value prio : prio of the value in to the queue ( Int )
+ * @return success ( Bool )
*/
public function contains( value : T , prio : Int ) : Bool {
@@ -83,7 +120,7 @@ class PriorityQueue<T>{
}
/**
- *
+ * Sort the queue content
*
* @public
* @return void
@@ -93,10 +130,10 @@ class PriorityQueue<T>{
}
/**
- *
+ * Test for invalidation and return the content Iterator
*
* @public
- * @return void
+ * @return queue content iterator ( PrioQueueIterator<T> )
*/
public function iterator( ) : PrioQueueIterator<T> {
@@ -108,10 +145,12 @@ class PriorityQueue<T>{
}
/**
- *
+ * Change the priority of a value
*
* @public
- * @return void
+ * @param value : Value ( T )
+ * @param prio : New priority ( Int )
+ * @return Void
*/
public function setPrioOf( value : T , prio : Int ) : Void {
@@ -124,10 +163,12 @@ class PriorityQueue<T>{
}
/**
- *
+ * Get the priority of the first instance of T in the queue
+ * return -1 if the value is not contained by the <code>PriorityQueue</code>
*
* @public
- * @return void
+ * @param value : Value to be test ( T )
+ * @return First priority of the value ( Int )
*/
public function getPrioOf( value : T ) : Int {
var b = false;
@@ -141,10 +182,10 @@ class PriorityQueue<T>{
}
/**
- *
+ * Get the content of the PriorityQueue childs <PrioDesc<T>>
*
* @public
- * @return void
+ * @return queue content ( PrioDesc<T> )
*/
public function getContent( ) : Array<PrioDesc<T>> {
return _aContent;
@@ -153,7 +194,7 @@ class PriorityQueue<T>{
// -------o protected
/**
- *
+ * Sort the content of the queue by priority
*
* @private
* @return void
@@ -167,10 +208,12 @@ class PriorityQueue<T>{
}
/**
- *
+ * Add a new value to the queue
*
* @private
- * @return void
+ * @param value : Value to add ( T )
+ * @param prio : Priority of the value in to the queue ( Int )
+ * @return Void
*/
private function _add( desc : PrioDesc<T> , prio : Int ) : Void{
var inc = _aContent.length;
@@ -183,10 +226,10 @@ class PriorityQueue<T>{
}
/**
- *
+ * Getter of the queue size
*
* @private
- * @return void
+ * @return size of the queue ( Int )
*/
private function _getLength( ) : Int{
return _aContent.length;
Please sign in to comment.
Something went wrong with that request. Please try again.