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

📄 memareainfo.java

📁 用JAVA实现的模拟内存管理程序
💻 JAVA
字号:
/*
 * Created on 2004-5-19
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */

/**
 * @author 李秋军(010200)
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */

class MemAreaInfo
{
	private int startAddr; //内存块起始地址
	private int length; //内存块的长度
	private boolean isAlloc; //内存块是否已分配
	private int id; //若已分配, id对应作业号, 否则为-1

	public MemAreaInfo()
	{
	}

	public MemAreaInfo(int startAddr, int length, boolean isAlloc, int id)
	{
		this.startAddr = startAddr;
		this.length = length;
		this.isAlloc = isAlloc;
		this.id = id;
	}

	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append("    ");
		sb.append(startAddr);
		sb.append("K           ");
		sb.append(length);
		sb.append("M            ");
		sb.append((isAlloc == true ? "已分配" : "空闲"));
		return sb.toString();
	}

	/**
	 * @return
	 */
	public int getId()
	{
		return id;
	}

	/**
	 * @return
	 */
	public boolean isAlloc()
	{
		return isAlloc;
	}

	/**
	 * @return
	 */
	public int getLength()
	{
		return length;
	}

	/**
	 * @return
	 */
	public int getStartAddr()
	{
		return startAddr;
	}

	/**
	 * @param i
	 */
	public void setId(int i)
	{
		id = i;
	}

	/**
	 * @param b
	 */
	public void setAlloc(boolean b)
	{
		isAlloc = b;
	}

	/**
	 * @param i
	 */
	public void setLength(int i)
	{
		length = i;
	}

	/**
	 * @param i
	 */
	public void setStartAddr(int i)
	{
		startAddr = i;
	}

}

⌨️ 快捷键说明

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