/
IntegerDataParameter.java
42 lines (35 loc) · 1.12 KB
/
IntegerDataParameter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package c4sci.data;
import c4sci.data.internationalization.InternationalizableTerm;
/**
* This class is provided to contain and integer type parameter.
* @author jeanmarc.deniel
*
*/
public class IntegerDataParameter extends DataParameter {
private int paramValue;
public IntegerDataParameter(String token_str, InternationalizableTerm name_term, InternationalizableTerm descr_term){
super(token_str, name_term, descr_term);
paramValue = 0;
}
public String getParameterValue() {
return Integer.toString(paramValue);
}
public void setParameterValue(String str_to_parse)
throws DataValueParsingException {
if (str_to_parse == null){
throw new DataValueParsingException("Integer", "(null)", "parsing error : null argument", null);
}
try{
paramValue = Integer.parseInt(str_to_parse);
}
catch (NumberFormatException _e){
throw new DataValueParsingException("Integer value", str_to_parse, "Integer parsing error", _e);
}
}
public int getIntegerValue(){
return paramValue;
}
public void setIntegerValue(final int int_val){
paramValue = int_val;
}
}