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.formaters.mml.*;
34
35 /***
36 * Formats the formula tree structure as its corresponding MathML object.<BR>
37 * This is the formater of the addition operator.
38 *
39 * @author © 2000 DIRAT Laurent
40 * @version 1.0 07/01/2000
41 */
42 public class GroupFormater implements Formater {
43 /***
44 * Returns the specified object formatted as a string.
45 * @param formatedObject the formatted object (for structured object, could represents the beginning).
46 * @param formaterRepository where the different other formaters are.
47 * @param obj the object to format.
48 */
49 public String format(String formatedObject, FormaterRepository formaterRepository, Object obj) {
50 PMathMLFormater mmlFormater = (PMathMLFormater) formaterRepository;
51 FormulaTreeStructure fts = (FormulaTreeStructure) obj;
52
53 FormulaTreeStructure ftsChild;
54 Formater formater;
55
56 String symbolId = fts.getResourceIdentifier();
57
58
59
60 int nbChildren = fts.getNbChildren();
61 for (int i = 0; i < nbChildren; i++) {
62 ftsChild = (FormulaTreeStructure) fts.getChild(i);
63 ftsChild = (FormulaTreeStructure) ftsChild.getChild(0);
64 String objectId = ftsChild.getResourceIdentifier();
65 formater = formaterRepository.getFormater(objectId);
66 formatedObject = formater.format(formatedObject, formaterRepository, ftsChild);
67 }
68
69
70
71 return formatedObject;
72 }
73 }