EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012) |
---|
[all classes][de.uka.ipd.sdq.simucomframework.variables.functions] |
name | class, % | method, % | block, % | line, % |
---|---|---|---|---|
TruncFunction.java | 0% (0/1) | 0% (0/3) | 0% (0/42) | 0% (0/9) |
name | class, % | method, % | block, % | line, % |
---|---|---|---|---|
class TruncFunction | 0% (0/1) | 0% (0/3) | 0% (0/42) | 0% (0/9) |
TruncFunction (): void | 0% (0/1) | 0% (0/3) | 0% (0/1) | |
checkParameters (List): boolean | 0% (0/1) | 0% (0/20) | 0% (0/5) | |
evaluate (List): Object | 0% (0/1) | 0% (0/19) | 0% (0/3) |
1 | package de.uka.ipd.sdq.simucomframework.variables.functions; |
2 | |
3 | import java.util.List; |
4 | |
5 | public class TruncFunction implements IFunction { |
6 | |
7 | public boolean checkParameters(List<Object> parameters) { |
8 | if (parameters.size() != 1) |
9 | return false; |
10 | if (!(parameters.get(0) instanceof Double) && !(parameters.get(0) instanceof Integer)) |
11 | return false; |
12 | return true; |
13 | } |
14 | |
15 | public Object evaluate(List<Object> parameters) { |
16 | if (parameters.get(0) instanceof Integer) |
17 | return parameters.get(0); |
18 | return (int)Math.round(Math.floor((Double)parameters.get(0))); |
19 | } |
20 | |
21 | } |
[all classes][de.uka.ipd.sdq.simucomframework.variables.functions] |
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov |