# -*- coding: iso-8859-1 -*- # Copyright 20003 - 2008: Julien Bourdaillet (julien.bourdaillet@lip6.fr), Jean-Gabriel Ganascia (jean-gabriel.ganascia@lip6.fr) # This file is part of MEDITE. # # MEDITE is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # MEDITE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Foobar; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #---------------------------------------------------------------------------- # Nom: transformations.py # Objet: Classe qui regoupe les donnees d'une comparaison d'un couple # d'état ( utilisee pour construire le fichier xml ) #---------------------------------------------------------------------------- import sys,Utile.decodage class Transformations: # Constructeur de la classe def __init__(self, pInsertions, pSuppressions, pDeplacements, pRemplacements, pTexteSource, pTexteCible): ## les attributs ci-dessous sont des listes de sequence de caracteres self.__insertions =pInsertions self.__suppressions =pSuppressions self.__deplacements = pDeplacements self.__remplacements = pRemplacements ## les attributs ci-dessous sont des noeuds xml self.__texteSource = pTexteSource self.__texteCible = pTexteCible # Methodes d'acces aux attributs privees def getInsertions(self): return self.__insertions def getSuppressions(self): return self.__suppressions def getDeplacements(self): return self.__deplacements def getRemplacements (self): return self.__remplacements def getSource(self): return self.__texteSource def getCible(self): return self.__texteCible def toString(self): s = u"Type TRANSFORMATION\nInsertions : " for i in self.__insertions: s += i+u" / " s += u"\nSuppressions : " for i in self.__suppressions: s += i+u" / " s += u"\nDéplacements : " for i in self.__deplacements: s += i+u" / " s += "\nRemplacements : " if self.__remplacements: for i in self.__remplacements: s += unicode(i).encode("iso-8859-2", "replace")+" / " s += "\nTexteSource : " #s += unicode(self.__texteSource.toxml()).encode("iso-8859-2", "replace") s2,x,y = Utile.decodage.decode_string_heuristically(self.__texteSource.toxml()) s += s2 # if self.__texteSource != []: # for i in self.__texteSource: # s += unicode(i).encode("iso-8859-2", "replace")+" / " s += "\nTexteCible : " s2,x,y = Utile.decodage.decode_string_heuristically(self.__texteCible.toxml()) s += s2 # s += unicode(self.__texteCible).encode("iso-8859-2", "replace") # if self.__texteCible != []: # for i in self.__texteCible: # s += unicode(i).encode("iso-8859-2", "replace")+" / " sys.stderr.write(unicode(s).encode("iso-8859-2", "replace")) sys.stderr.flush()