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 UnaryFormater 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 objectId = fts.getResourceIdentifier();
57 formatedObject += mmlFormater.writeSymbol(objectId, fts.getCrossRef());
58
59 ftsChild = (FormulaTreeStructure) fts.getChild(0);
60 objectId = ftsChild.getResourceIdentifier();
61 formater = formaterRepository.getFormater(objectId);
62 formatedObject = formater.format(formatedObject, formaterRepository, ftsChild);
63
64
65 return formatedObject;
66 }
67 }