Rev 1569 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1574 | jmachado | 1 | package pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils; |
1569 | jmachado | 2 | |
3 | import pt.estgp.estgweb.utils.ConfigProperties; |
||
4 | |||
5 | import java.util.ArrayList; |
||
6 | |||
7 | /** |
||
8 | * Created by jorgemachado on 16/12/16. |
||
9 | */ |
||
10 | public class ReportUtils |
||
11 | { |
||
12 | public static ArrayList<String> getFormatedDegrees(1.5.0/docs/api/java/lang/String.html">String[] degrees) { |
||
13 | ArrayList<String> degreesList = new ArrayList<String>(); |
||
14 | if(degrees != null) |
||
15 | { |
||
16 | for(1.5.0/docs/api/java/lang/String.html">String d: degrees) |
||
17 | degreesList.add(ConfigProperties.getProperty("course." + d)); |
||
18 | } |
||
19 | return degreesList; |
||
20 | |||
21 | } |
||
22 | |||
23 | public static ArrayList<String> getFormatedSemestres(1.5.0/docs/api/java/lang/String.html">String[] periodos) |
||
24 | { |
||
25 | ArrayList<String> semestres = new ArrayList<String>(); |
||
26 | if(periodos != null) |
||
27 | { |
||
28 | for(1.5.0/docs/api/java/lang/String.html">String p: periodos) |
||
29 | semestres.add(p); |
||
30 | } |
||
31 | return semestres; |
||
32 | } |
||
33 | |||
34 | |||
35 | public static double round(double value, int places) { |
||
36 | if (places < 0) throw new 1.5.0/docs/api/java/lang/IllegalArgumentException.html">IllegalArgumentException(); |
||
37 | |||
38 | long factor = (long) 1.5.0/docs/api/java/lang/Math.html">Math.pow(10, places); |
||
39 | value = value * factor; |
||
40 | long tmp = 1.5.0/docs/api/java/lang/Math.html">Math.round(value); |
||
41 | return (double) tmp / factor; |
||
42 | } |
||
43 | } |