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

📄 linklist.java

📁 简单的停车场管理程序,运用了队列与栈来进行车辆存储与停车管理计费
💻 JAVA
字号:
package com.he.java;
import java.io.*;
import com.he.java.*;
public class LinkList  
{
	public ListNode Header;
	public int LinkListLength;
	public LinkList()
	{
		Header = new ListNode (null);
		LinkListLength = 0;
	}
	
	public void Insert(int i ,ListNode n)
	{	
		ListNode current = Header;		
		if (i<0||i>LinkListLength)
		{
			System.out.println("插入标志值超过范围");
			return;
		}
		for (int j = 0;j<i ;j++ )
		{
			current = current.next;

		}
		
		n.next = current.next;
		current.next = n;
		LinkListLength ++;
	}
	public void Delete(int i)
	{
		ListNode current = Header;
		if (i<=0||i>LinkListLength)
		{
			System.out.println("插入标志值超过范围");
			return;
		}
		for (int j = 0;j<i-1 ;j++ )
		{
			current = current.next;

		}
		current.next = current.next.next;
		LinkListLength --;
	}
	public int QueryId(ListNode n)
	{
		ListNode current = Header;
		int i=0;
		while (current != n)
		{
			i++;
			if (i == 0||i>LinkListLength)
			{
				System.out.println("插入标志值超过范围");
				return 0;
			}
		}
		return i;
	}
		
		

	public ListNode Query(int i)
	{
		ListNode current = Header;
		if (i<=0||i>LinkListLength)
		{
			System.out.println("查找标志值超过范围");
			return null;
		}
		for (int j = 0;j<i ;j++ )
		{
			current = current.next;

		}
		return current;
	}
	public int getLength()
	{
		return LinkListLength;
	}
}

⌨️ 快捷键说明

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