1 package fr.ove.openmath.jome.model;
2
3 import fr.ove.utils.CachingResourcesManager;
4
5 /***
6 * The resources manager for the formula.<BR>
7 *
8 * @author © 2000 DIRAT Laurent
9 * @version 2.1 10/01/2000
10 */
11 public class FormulaResourcesManager extends CachingResourcesManager {
12 /***
13 * Constructor
14 * @param resourcesName the name of the resources file. <BR> he name is specified without the ".properties"
15 * extension. If the property file is located in a package, the fully qualified name (e.g. my.package.filename)
16 * must be used.
17 */
18 public FormulaResourcesManager(String resourcesName) {
19 super(resourcesName);
20 }
21
22 /***
23 * Returns the class name corresponding to the specified property.
24 * @param property the specified property
25 */
26 public String getClassName(String property) {
27 return accessResource(property, 0);
28 }
29
30 /***
31 * Returns the arity resource corresponding to the specified property.
32 * @param property the specified property
33 */
34 public Integer getArity(String property) {
35 String arity = accessResource(property, 2);
36 Integer value = null;
37
38 if (arity != null) {
39 try {
40 value = Integer.valueOf(arity);
41 }
42 catch (NumberFormatException fne) {
43 System.out.println("Wrong operator arity : " + property);
44 }
45 }
46
47 return value;
48 }
49
50 public String getPrioritiesIdentifier(String property) {
51 return accessResource(property, 1);
52 }
53
54 /***
55 * Returns the as operator resource corresponding to the specified property.
56 * @param property the specified property
57 */
58 public int getAsOperatorPriority(String property) {
59 String priority = accessResource(property, 0);
60 int value = 0;
61
62 try {
63 value = Integer.valueOf(priority).intValue();
64 }
65 catch (NumberFormatException fne) {
66 System.out.println("Wrong specification of as operator priority : " + priority);
67 }
68
69 return value;
70 }
71
72 /***
73 * Returns the as operand resource corresponding to the specified property.
74 * @param property the specified property
75 */
76 public int getAsOperandPriority(String property) {
77 String priority = accessResource(property, 1);
78 int value = 0;
79
80 try {
81 value = Integer.valueOf(priority).intValue();
82 }
83 catch (NumberFormatException fne) {
84 System.out.println("Wrong specification of as operand priority : " + priority);
85 }
86
87 return value;
88 }
89 }