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 package fr.ove.openmath.jome.formaters.pmml;
30
31 import fr.ove.utils.*;
32 import fr.ove.openmath.jome.model.*;
33 import fr.ove.openmath.jome.behaviour.Maskable;
34 import fr.ove.openmath.jome.formaters.mml.*;
35
36 /***
37 * Formats the formula tree structure as its corresponding MathML object.<BR>
38 * Format the child of the instance.
39 *
40 * @author © 2000 DIRAT Laurent
41 * @version 1.0 23/05/2000
42 */
43 public class ParenthesizeFormater implements Formater {
44 /***
45 * Returns the specified object formatted as a string.
46 * @param formatedObject the formatted object (for structured object, could represents the beginning).
47 * @param formaterRepository where the different other formaters are.
48 * @param obj the object to format.
49 */
50 public String format(String formatedObject, FormaterRepository formaterRepository, Object obj) {
51 PMathMLFormater mmlFormater = (PMathMLFormater) formaterRepository;
52
53 FormulaTreeStructure fts = (FormulaTreeStructure) obj;
54 String symbolId = fts.getResourceIdentifier();
55
56 Object parent = fts.getFather();
57
58
59
60
61
62 FormulaTreeStructure ftsChild = (FormulaTreeStructure) ((FormulaTreeStructure) obj).getChild(0);
63 String objectId = ftsChild.getResourceIdentifier();
64 Formater formater = formaterRepository.getFormater(objectId);
65
66 formatedObject = formater.format(formatedObject, formaterRepository, ftsChild);
67
68
69
70
71
72 return formatedObject;
73 }
74 }