com. kelvinluck. flashr. core. FlashrRequestQueue

Handles the queue of FlashrRequest objects sent to the Flickr API.

See Also

Flashr.queue

Licence

This code and documentation is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0.  http://creativecommons.org/licenses/by-nc-sa/2.0/

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.

Version

0.5.0

Author

Kelvin Luck < kelvin at kelvinluck dot com >

Project Website

http://flashr.kelvinluck.com/

Subversion Id

$Id: FlashrRequestQueue.as 82 2006-09-10 18:43:14Z kluck $

Summary
com. kelvinluck. flashr. core. FlashrRequestQueueHandles the queue of FlashrRequest objects sent to the Flickr API.
FlashrRequestQueuePrivate constructor - there should only be one queue so use getInstance to get it...
clearQueueEmpties the queue.
getNextGet the next FlashrRequest Object to be sent to flickr.com and removes it from the queue.
addToQueueAdds a FlashrRequest to the queue.
removeFromQueueRemoves a given request from the queue.
isEmptyTells you whether the request queue is empty or not.
getTopPriorityTells you the priority of the FlashrRequest which is currently at the front of the queue.
setPrioritySets the priority of the passed FlashrRequest to the passed value if the FlashrRequest is in the queue, otherwise returns false
getInstanceGets a reference to the Singleton instance of this class.
toString

FlashrRequestQueue

private function FlashrRequestQueue()

Private constructor - there should only be one queue so use getInstance to get it...

clearQueue

function clearQueue()

Empties the queue.

getNext

function getNext():FlashrRequest

Get the next FlashrRequest Object to be sent to flickr.com and removes it from the queue.

Returns

The next FlashrRequest Object to be sent to flickr.com.

addToQueue

function addToQueue(request: FlashrRequest,
priority: Number)

Adds a FlashrRequest to the queue.

Parameters

requestThe FlashrRequest you want to add to the queue.
priorityThe priority of this request.

removeFromQueue

function removeFromQueue(request: FlashrRequest):Boolean

Removes a given request from the queue.

Parameters

The FlashrRequest you want to remove.

Returns

True if the request was found and removed, false otherwise.

isEmpty

function isEmpty():Boolean

Tells you whether the request queue is empty or not.

Returns

True if the queue is empty, false if there is still stuff in it...

getTopPriority

function getTopPriority():Number

Tells you the priority of the FlashrRequest which is currently at the front of the queue.

Returns

The priority of the FlashrRequest at the front of the queue or undefined if the queue isEmpty

setPriority

function setPriority(request: FlashrRequest,
priority: Number):Boolean

Sets the priority of the passed FlashrRequest to the passed value if the FlashrRequest is in the queue, otherwise returns false

Parameters

requestThe FlashrRequest you want to change the priority of.
priorityThe priority you want to change it to.

Returns

True if the request was in the queue and had it’s priority changes, false otherwise

See Also

FlashrRequest.setPriority

getInstance

public static function getInstance():FlashrRequestQueue

Gets a reference to the Singleton instance of this class.

Returns

A reference to the one and only FlashrRequestQueue.

toString

public function toString():String
Class to hold information about requests to the Flickr API through Flashr
private function FlashrRequestQueue()
Private constructor - there should only be one queue so use getInstance to get it...
public static function getInstance():FlashrRequestQueue
Gets a reference to the Singleton instance of this class.
function clearQueue()
Empties the queue.
function getNext():FlashrRequest
Get the next FlashrRequest Object to be sent to flickr.com and removes it from the queue.
function addToQueue(request: FlashrRequest,
priority: Number)
Adds a FlashrRequest to the queue.
function removeFromQueue(request: FlashrRequest):Boolean
Removes a given request from the queue.
function isEmpty():Boolean
Tells you whether the request queue is empty or not.
function getTopPriority():Number
Tells you the priority of the FlashrRequest which is currently at the front of the queue.
function setPriority(request: FlashrRequest,
priority: Number):Boolean
Sets the priority of the passed FlashrRequest to the passed value if the FlashrRequest is in the queue, otherwise returns false
public function toString():String
function get queue():FlashrRequestQueue
The FlashrRequestQueue.
function setPriority(priority: Number):Boolean
If this request is in the FlashrRequestQueue then sets it’s priority to the passed value.