📄 queue.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: Queue.java
package com.cmpp3_0.thread;
import com.cmpp3_0.body.BodyPacket;
import com.cmpp3_0.util.Logger;
import java.util.Vector;
public class Queue
{
private int capacity;
private Vector v;
public Queue()
{
v = new Vector(50);
capacity = 100;
}
public int capacity()
{
return capacity;
}
public synchronized BodyPacket dequeue()
{
Vector vector = v;
JVM INSTR monitorenter ;
if(v.size() <= 0)
return null;
if(!(v.elementAt(0) instanceof BodyPacket)) goto _L2; else goto _L1
_L1:
BodyPacket bodyPacket;
bodyPacket = (BodyPacket)v.elementAt(0);
v.remove(0);
bodyPacket;
vector;
JVM INSTR monitorexit ;
return;
_L2:
Logger.writeLog(-1, "the type of the object in the queue is not BodyPacket", "cmpp");
null;
vector;
JVM INSTR monitorexit ;
return;
Exception exception;
exception;
vector;
JVM INSTR monitorexit ;
throw exception;
}
public boolean empty()
{
return v.size() == 0;
}
public void enqueue(BodyPacket bodyPacket)
{
synchronized(v)
{
if(bodyPacket != null)
v.addElement(bodyPacket);
}
}
public Vector getAllElements()
{
Vector vect = new Vector(10, 10);
synchronized(v)
{
for(int i = 0; i < v.size(); i++)
vect.add(v.elementAt(i));
}
return vect;
}
public void setMaxCapacity(int capacity)
{
this.capacity = capacity;
}
public int size()
{
return v.size();
}
public String toString()
{
String result = "size: " + v.size() + " capacity: " + capacity;
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -