psimjava
Class Pqueue

java.lang.Object
  extended by psimjava.Pqueue

public class Pqueue
extends java.lang.Object

PsimJ Java package for OO simulation

Object-oriented simulation package, process interaction approach. PsimJ (C)Jose M. Garrido, June 2000, August 2003, 2007

(C) J. M. Garrido. June 2000, 2003, 2004, 2007 Priority queue class for PsimJ.

PsimJ package, process interaction approach to simulation. (C) J. M. Garrido, June 2000, August 2003, 2004, 2007


Constructor Summary
Pqueue(java.lang.String a_name, int max_prio)
          Initializes priority queue object with title and maximum priority to use.
Pqueue(java.lang.String a_name, int max_prio, int maxsize)
          Initializes priority queue object with title, maximum number of priorities to use, and the capacity of the component queues.
 
Method Summary
 boolean empty()
          Returns a true if total queue is empty, otherwise, return false
 boolean full(int prio)
          Returns true if queue is full of processes with priority prio, returns false otherwise
 void into(java.lang.Object ps)
          Enqueue the specified object (process) into the priority queue
 int length()
          Returns the total length of the priority queue
 java.lang.Object llast()
          get last object enqueued to lowest priority queue
 int maxprio()
          Return the maximum priority used
 java.lang.Object out()
          Dequeue object (process) with the highest priority
 void pback(java.lang.Object ps)
          Place the specified object (process) at the head of the queue
 java.lang.Object plast(int prio)
          Get last object enqueued with the specified priority
 int plength(int prio)
          Returns the length of a particular queue with given priority
 java.lang.Object pllast(int pr)
          Get last object enqueued into lowest priority queue, down to the specified priority
 java.lang.Object pout(int prio)
          Dequeues an object (process) with the specified priority
 void premov(java.lang.Object ps)
          Remove the specified object (process) from the priority queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pqueue

public Pqueue(java.lang.String a_name,
              int max_prio)
Initializes priority queue object with title and maximum priority to use.


Pqueue

public Pqueue(java.lang.String a_name,
              int max_prio,
              int maxsize)
Initializes priority queue object with title, maximum number of priorities to use, and the capacity of the component queues.

Parameters:
s_name - title for the priority queue
max_prio - maximum priority to use
maxsize - capacity (maximum size) of the component queues
Method Detail

length

public int length()
Returns the total length of the priority queue


empty

public boolean empty()
Returns a true if total queue is empty, otherwise, return false


plength

public int plength(int prio)
Returns the length of a particular queue with given priority

Parameters:
prio - priority of the queue

full

public boolean full(int prio)
Returns true if queue is full of processes with priority prio, returns false otherwise


maxprio

public int maxprio()
Return the maximum priority used


into

public void into(java.lang.Object ps)
Enqueue the specified object (process) into the priority queue

Parameters:
ps - The object (process) to insert into the queue

premov

public void premov(java.lang.Object ps)
Remove the specified object (process) from the priority queue

Parameters:
ps - The object (process) to remove from the queue

pback

public void pback(java.lang.Object ps)
Place the specified object (process) at the head of the queue

Parameters:
ps - The object (process) to place into the queue

out

public java.lang.Object out()
Dequeue object (process) with the highest priority


pout

public java.lang.Object pout(int prio)
Dequeues an object (process) with the specified priority

Parameters:
prio - Priority of the object to dequeue

plast

public java.lang.Object plast(int prio)
Get last object enqueued with the specified priority

Parameters:
prio - Priority of the object to retrieve

llast

public java.lang.Object llast()
get last object enqueued to lowest priority queue


pllast

public java.lang.Object pllast(int pr)
Get last object enqueued into lowest priority queue, down to the specified priority