1 package fr.ove.openmath.jome.formaters.om;
2
3 import fr.ove.utils.*;
4 import fr.ove.openmath.jome.model.*;
5 import fr.ove.openmath.jome.formaters.om.*;
6
7 /***
8 * Formats the formula tree structure as its corresponding OpenMath object.<BR>
9 * Format the icon "operator"
10 *
11 * @author © 2000 DIRAT Laurent
12 * @version 1.0 07/01/2000
13 */
14 public class IconFormater implements Formater {
15 /***
16 * Returns the specified object formatted as a string.
17 * @param formatedObject the formatted object (for structured object, could represents the beginning).
18 * @param formaterRepository where the different other formaters are.
19 * @param obj the object to format.
20 */
21 public String format(String formatedObject, FormaterRepository formaterRepository, Object obj) {
22 Icon fts = (Icon) obj;
23 FormulaTreeStructure ftsChild;
24 String objectId;
25 Formater formater;
26
27 int nbChildren = fts.getNbChildren();
28 for (int i = 0; i < nbChildren; i++) {
29 ftsChild = (FormulaTreeStructure) fts.getIconified(i);
30 objectId = ftsChild.getResourceIdentifier();
31 formater = formaterRepository.getFormater(objectId);
32 formatedObject = formater.format(formatedObject, formaterRepository, ftsChild);
33 }
34
35 return formatedObject;
36 }
37 }