Package medite :: Package Donnees :: Module transformations
[hide private]
[frames] | no frames]

Source Code for Module medite.Donnees.transformations

 1  # -*- coding: iso-8859-1 -*- 
 2  # Copyright 20003 - 2008: Julien Bourdaillet (julien.bourdaillet@lip6.fr), Jean-Gabriel Ganascia (jean-gabriel.ganascia@lip6.fr) 
 3  # This file is part of MEDITE. 
 4  # 
 5  #    MEDITE is free software; you can redistribute it and/or modify 
 6  #    it under the terms of the GNU General Public License as published by 
 7  #    the Free Software Foundation; either version 2 of the License, or 
 8  #    (at your option) any later version. 
 9  # 
10  #    MEDITE is distributed in the hope that it will be useful, 
11  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
12  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
13  #    GNU General Public License for more details. 
14  # 
15  #    You should have received a copy of the GNU General Public License 
16  #    along with Foobar; if not, write to the Free Software 
17  #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
18  #---------------------------------------------------------------------------- 
19  # Nom:          transformations.py 
20  # Objet:        Classe qui regoupe les donnees d'une comparaison d'un couple 
21  #               d'état ( utilisee pour construire le fichier xml ) 
22  #---------------------------------------------------------------------------- 
23   
24  import sys,Utile.decodage 
25   
26 -class Transformations:
27 28 # Constructeur de la classe
29 - def __init__(self, pInsertions, pSuppressions, pDeplacements, pRemplacements, pTexteSource, pTexteCible):
30 ## les attributs ci-dessous sont des listes de sequence de caracteres 31 self.__insertions =pInsertions 32 self.__suppressions =pSuppressions 33 self.__deplacements = pDeplacements 34 self.__remplacements = pRemplacements 35 ## les attributs ci-dessous sont des noeuds xml 36 self.__texteSource = pTexteSource 37 self.__texteCible = pTexteCible
38 39 # Methodes d'acces aux attributs privees
40 - def getInsertions(self):
41 return self.__insertions
42
43 - def getSuppressions(self):
44 return self.__suppressions
45
46 - def getDeplacements(self):
47 return self.__deplacements
48
49 - def getRemplacements (self):
50 return self.__remplacements
51
52 - def getSource(self):
53 return self.__texteSource
54
55 - def getCible(self):
56 return self.__texteCible
57
58 - def toString(self):
59 s = u"Type TRANSFORMATION\nInsertions : " 60 for i in self.__insertions: 61 s += i+u" / " 62 s += u"\nSuppressions : " 63 for i in self.__suppressions: 64 s += i+u" / " 65 s += u"\nDéplacements : " 66 for i in self.__deplacements: 67 s += i+u" / " 68 s += "\nRemplacements : " 69 if self.__remplacements: 70 for i in self.__remplacements: 71 s += unicode(i).encode("iso-8859-2", "replace")+" / " 72 s += "\nTexteSource : " 73 #s += unicode(self.__texteSource.toxml()).encode("iso-8859-2", "replace") 74 s2,x,y = Utile.decodage.decode_string_heuristically(self.__texteSource.toxml()) 75 s += s2 76 # if self.__texteSource != []: 77 # for i in self.__texteSource: 78 # s += unicode(i).encode("iso-8859-2", "replace")+" / " 79 s += "\nTexteCible : " 80 s2,x,y = Utile.decodage.decode_string_heuristically(self.__texteCible.toxml()) 81 s += s2 82 # s += unicode(self.__texteCible).encode("iso-8859-2", "replace") 83 # if self.__texteCible != []: 84 # for i in self.__texteCible: 85 # s += unicode(i).encode("iso-8859-2", "replace")+" / " 86 sys.stderr.write(unicode(s).encode("iso-8859-2", "replace")) 87 sys.stderr.flush()
88