All pastes #31006 Raw Edit

Someone

public text v1 · immutable
#31006 ·published 2005-11-24 23:31 UTC
rendered paste body
public void enqueue (Object o, int priority)
	{
		boolean key = false;
		
		if(!this.isEmpty())
		{
			this.setFirst();
			//while current value is not null check
			while (this.currValue() != null && key != true)
			{
				if(priority >= this.currPriority())
				{
					if (priority >0)
					{
						if (priority == this.currPriority())
						{
							while(this.currPriority() == priority)
							{
								this.next();
							}
							this.insert(o, priority);
							key = true;
						}
						
						else
						{
							this.insert(o, priority);
							key = true;
						}
						
					}
					
					else
					{
						this.insert(o, priority);
						key = true;
					}						
				}
				if (priority != this.currPriority())
					this.next();
			}	
		}
		
		else
		{
			this.insert(o,priority);
		}
	}