statistic.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 64 行

JAVA
64
字号
/*
 * $Id: Statistic.java,v 1.1 2003/11/25 11:41:47 epr Exp $
 */
package org.jnode.util;

/**
 * @author epr
 */
public class Statistic {
	
	private final String name;
	private final String description;
	private int counter;
	
	public Statistic(String name) {
		this(name, null);
	}

	public Statistic(String name, String description) {
		this.name = name;
		this.description = description;
	}

	/**
	 * Gets the counter of this statistic
	 * @return the counter
	 */
	public int get() {
		return counter;
	}

	/**
	 * Gets the name of this statistic
	 * @return The name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Increment the counter of this statistic by 1.
	 */
	public void inc() {
		counter++;
	}
	
	/**
	 * Convert to a String representation
	 * @see java.lang.Object#toString()
	 * @return String
	 */
	public String toString() {
		return name + "=" + counter;
	}
	
	/**
	 * Gets the description of this statistic
	 * @return The description
	 */
	public String getDescription() {
		return description;
	}
}

⌨️ 快捷键说明

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