⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pqueue.java

📁 PEPA模型性能分析工具
💻 JAVA
字号:
package trans;
import semantic.Process;

public class PQueue {
	PNode node;
	PQueue next;
	private static int count=0;
	public PQueue()
	{
		node=null;
		next=null;
		count=0;
	}
	public int Count()
	{
		return count;
	}
	public int find(Process o)
	{
		Process pro;
		PNode p;
		PQueue q=this;
		while(q.next!=null)
		{
			p=q.node;
			pro=p.value;
			if(pro.equals(o))
				return p.id;
			q=q.next;
		}
		p=q.node;
		pro=p.value;
		if(pro.equals(o))
			return p.id;
		return 0;
		
	}
	public String find(int i)
	{
		PQueue pos=this;
		int j=1;
		while(j<count&&pos!=null)
		{
			if(j==i) break;
			j++;
			pos=pos.next;
		}
		PNode n=pos.node;
		if(n!=null)
		{
			return i+":\t"+n.toString();
		}
		else
			return null;
	}
	public PQueue(PNode n)
	{
		node=n;
		next=null;
	}
	public int put(Process o)
	{
		PNode p;
		Process pro;
		if(node==null)
		{	
			node=new PNode(o,++count);
			return count;
		}
		else
		{
			PQueue q=this;
			
			while(q.next!=null)
			{
				p=q.node;
				pro=p.value;
				if(pro.equals(o))
					return p.id;
				q=q.next;
			}
			p=q.node;
			pro=p.value;
			if(pro.equals(o))
				return p.id;
			
			q.next=new PQueue(new PNode(o,++count));
			return count;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -