jobdeletioninfo.java

来自「打印管理程序,测试完全通过.windows开发环境.」· Java 代码 · 共 65 行

JAVA
65
字号
/* 
    $Author: $
    $Date: $
    $Revision: $
    $NoKeywords: $
*/
package jp.co.ntl.spooler;

import java.io.*;

public class JobDeletionInfo implements java.io.Serializable {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int count;
    private boolean timeDeletion;
    private int time;
    
    public JobDeletionInfo() {}
    
    public final int getCount() { return count; }
    public final void setCount(int count) { this.count = count; }
    
    public final boolean isTimeDeletion() { return timeDeletion; }
    public final void setTimeDeletion(boolean timeDeletion) { this.timeDeletion = timeDeletion; }
    
    public final int getTime() { return time; }
    public final void setTime(int time) { this.time = time; }
    
    public void writeTo(PrintWriter pw) {
        // count
        pw.print("DeleteCount="); pw.println(getCount());
        // time deletion
        if (isTimeDeletion()) {
            pw.println("TimeDeletion=1");
        } else {
            pw.println("TimeDeletion=0");
        }
        // delete time
        pw.print("DeleteTime="); pw.println(getTime());
    }
    
    public boolean put(String key, String value) {
        if (key.equals("DeleteCount")) {
            try {
                setCount(Integer.parseInt(value));
            } catch (NumberFormatException e) {}
        } else if (key.equals("TimeDeletion")) {
            if (value.equals("1")) {
                setTimeDeletion(true);
            } else {
                setTimeDeletion(false);
            }
        } else if (key.equals("DeleteTime")) {
            try {
                setTime(Integer.parseInt(value));
            } catch (NumberFormatException e) {}
        } else {
            return false;
        }
        
        return true;
    }
}

⌨️ 快捷键说明

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