businessobject.java

来自「个人通讯录」· Java 代码 · 共 49 行

JAVA
49
字号
public class BusinessObject {
    int currentPos;
    PropertiesUtil proutil;
    
    public BusinessObject(){
        currentPos = 0;
        proutil = new PropertiesUtil("config/telephone.dat");
	}
	
	
	public User first() {
		currentPos = 0;
		return proutil.getUsers().get(0);
	}


	public User previous() {//前一个成员
		if(currentPos >0){
			currentPos --;
		}
		return proutil.getUsers().get(currentPos);
	}


	public User next() {//下一个成员
		if(currentPos < proutil.getUsers().size() - 1){
			currentPos ++;
		}
		return proutil.getUsers().get(currentPos);
	}


	public User last() {
		currentPos = proutil.getUsers().size() - 1;
		return proutil.getUsers().get(currentPos);
	}
	

	public void saveUser(User user) {
		proutil.save(user);
		currentPos = proutil.getUsers().indexOf(user);
	}	
	
	public void deleteUser(int index){
		proutil.delete(index);		
	}
    
}

⌨️ 快捷键说明

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