keyword.java

来自「一个简单的词法分析程序..可以分析一关键字,还可以保存跟打开文件」· Java 代码 · 共 49 行

JAVA
49
字号
package scr.analyWords.word;

public class KeyWord implements Word {

	private int id;
    private String value="";
    private int type=1;
    private int counter=0;
    public KeyWord(int id,String value) {
        this.id=id;
        this.value=value;
    }
    public void setID(int id){
        this.id=id;
    }
    public void setValue(String v){
        this.value=v;
    }
    public int getID(){
        return id;
    }
    public String getValue(){
        return value;
    }
    public int compare(Word w){
        if(w.getID()==id){
            return 0;
        }
        return -1;
    }
    public String toString(){
        return "keyWord"+id+","+value;
    }
    
    public void increaseCounter(){
    	this.counter++;
    }
    
	public int getCounter() {
		// TODO 自动生成方法存根
		return counter;
	}
	public int getType() {
		// TODO 自动生成方法存根
		return type;
	}

}

⌨️ 快捷键说明

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