void ecrireXml(StringBuffer buf, int indent) {
   Divers.ecrire(buf, "<operation", indent);
   Divers.ecrireAttrXml(buf, "nom", nom);
   Divers.ecrire(buf, ">");
   for (Iterator<ModeleParametre> iter = parametres.iterator(); iter.hasNext(); ) {
     ModeleParametre param = iter.next();
     param.ecrireXml(buf, indent + 1);
   }
   for (Iterator<ModeleVariable> iter = retours.iterator(); iter.hasNext(); ) {
     ModeleVariable retour = iter.next();
     retour.ecrireRetourXml(buf, indent + 1);
   }
   for (Iterator<ModeleVariable> iter = variables.iterator(); iter.hasNext(); ) {
     ModeleVariable var = iter.next();
     var.ecrireXml(buf, indent + 1);
   }
   for (Iterator<ModeleInstruction> iter = instructions.iterator(); iter.hasNext(); ) {
     ModeleInstruction instr = iter.next();
     instr.ecrireXml(buf, indent + 1);
   }
   Divers.ecrire(buf, "</operation>", indent);
 }
Example #2
0
 private void initOperClasse() {
   try {
     i_pile = 0;
     pile[0] = "";
     ModeleOperation cur_oper = null;
     ModeleClasse cur_class = null;
     StringTokenizer tok = new StringTokenizer(buf_xml.toString(), "\n\r", false);
     String attr = null;
     while (tok.hasMoreTokens()) {
       String ligne = tok.nextToken();
       if (this.isClasse(ligne)) {
         cur_class = (ModeleClasse) creerObjet("Classe");
         attr = lireAttribut(ligne, "nom");
         if (attr != null) cur_class.nom = attr;
         prog_xml.classes.add(cur_class);
         cur_class.parent = prog_xml;
       } else if (this.isFinClasse(ligne)) {
         cur_class = null;
       } else if (this.isPropriete(ligne)) {
         if (cur_class == null) continue;
         ModeleVariable var = (ModeleVariable) creerObjet("Variable");
         attr = this.lireAttribut(ligne, "type");
         if (attr != null) var.type = attr;
         attr = this.lireAttribut(ligne, "nom");
         if (attr != null) var.nom = attr;
         cur_class.proprietes.add(var);
       } else if (this.isOper(ligne)) {
         cur_oper = (ModeleOperation) creerObjet("Operation");
         attr = lireAttribut(ligne, "nom");
         if (attr != null) cur_oper.nom = attr;
         if (cur_class == null) {
           prog_xml.operations.add(cur_oper);
           cur_oper.parent = prog_xml;
         } else {
           cur_class.operations.add(cur_oper);
           cur_oper.parent = cur_class;
         }
       } else if (this.isFinOper(ligne)) {
         cur_oper = null;
       } else if (this.isParametre(ligne)) {
         ModeleParametre arg = (ModeleParametre) creerObjet("Parametre");
         arg.nom = "";
         arg.type = "";
         arg.mode = "";
         attr = lireAttribut(ligne, "nom");
         if (attr != null) arg.nom = attr;
         attr = lireAttribut(ligne, "type");
         if (attr != null) arg.type = attr;
         attr = lireAttribut(ligne, "mode");
         if (attr != null) arg.mode = attr;
         if (cur_oper != null) {
           cur_oper.parametres.add(arg);
           arg.parent = cur_oper;
         }
       }
     }
   } catch (Exception ex) {
     prog_xml.ecrireWarning("probleme d'analyse du code Xml");
     ex.printStackTrace();
   }
 }