📄 argumentset.java
字号:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Calculator;
/**
*
* @author asus
*/
import java.util.HashMap;
/*I use hash map to store the arg,
* put(K key, V value) to store
* get(Object key) to get the value*/
public class ArgumentSet {
private HashMap<String, Double> args;
public ArgumentSet() {
args = new HashMap<String, Double>();
}
public void setArg(String name, double value) {
args.put(name, value);
//value is automatically cast to Double Class
}
public int sizeOfArgs(){
return args.size();
}
public double getArg(String name) {
Double result = args.get(name);
if (result == null) {
return 0.0;
} else {
return result;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -