📄 unit.java
字号:
/*
* Unit.java
*
* Created on 2006年5月5日, 上午11:20
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.j2medev.chapter4.weather;
/**
*
* @author ming
*/
public class Unit {
private String[] units = new String[4];
public static final int TEMPERATRUE = 0;
public static final int DISTANCE = 1;
public static final int PRESSURE = 2;
public static final int SPEED = 3;
/** Creates a new instance of Unit */
public Unit() {
}
public String get(int field){
if(field < 0 || field > 3)
throw new IllegalArgumentException("The unit field is not defined");
return units[field];
}
public void set(int index,String value){
units[index] = value;
}
//only for debug
public String toString(){
return "temperature : "+units[0]+"\n"
+"distance : "+units[1]+"\n"
+"pressure : "+units[2]+"\n"
+"speed : "+units[3]+"\n";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -