catalogueitem.java

来自「NAS文件器的模拟」· Java 代码 · 共 73 行

JAVA
73
字号
package fileSystem;

public class CatalogueItem {
	private INode iNode;
	private CatalogueItem tail = null;
	
	public CatalogueItem(int i){	
		if (VirtualData.isDir(i)){
			iNode = new DirINode(i);
		}
		else {
			iNode = new FileINode(i);
		}
	}
	
	public CatalogueItem(int i , String otherName){			
		if (VirtualData.isDir(i)){
			iNode = new DirINode(i, otherName);
		}
		else {
			iNode = new FileINode(i, otherName);
		}
	}
	
	public CatalogueItem addCatalogueItem (int i) {
		this.do_addCatalogueItem(i);
		return this;
	}
	
	private void do_addCatalogueItem(int i){
		if(this.tail == null) {
			this.tail = new CatalogueItem(i);
		}
		else {
			this.tail.do_addCatalogueItem(i);
		}
	}
	
	public CatalogueItem addCatalogueItem (int i, String otherName) {
		this.do_addCatalogueItem(i, otherName);
		return this;
	}
	
	private void do_addCatalogueItem(int i, String otherName){
		if(this.tail == null) {
			this.tail = new CatalogueItem(i, otherName);
		}
		else {
			this.tail.do_addCatalogueItem(i, otherName);
		}
	}
	
	public CatalogueItem getTail() {
		return tail;
	}
	
	public String getName () {
		return iNode.name;
	}
	
	public String getCreatTime(){
		return iNode.time_creat;
	}
	
	public String getAccessTime(){
		return iNode.time_access;
	}
	
	public String getIsDir(){
		return iNode.isDir;
	}
}

⌨️ 快捷键说明

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