umbrello API Documentation

idchangelog.cpp

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2002-2007                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 #include "idchangelog.h"
00013 
00014 #include <kdebug.h>
00015 
00016 IDChangeLog::IDChangeLog() {}
00017 
00018 IDChangeLog::IDChangeLog(const IDChangeLog& Other) {
00019     m_LogArray = Other.m_LogArray;
00020 }
00021 
00022 IDChangeLog::~IDChangeLog() {}
00023 
00024 IDChangeLog& IDChangeLog::operator=(const IDChangeLog& Other) {
00025     m_LogArray = Other.m_LogArray;
00026 
00027     return *this;
00028 }
00029 
00030 bool IDChangeLog::operator==(const IDChangeLog& /*Other*/) {
00031     /*It needs to be Implemented*/
00032     return false;
00033 }
00034 
00035 Uml::IDType IDChangeLog::findNewID(Uml::IDType OldID) {
00036     uint count = m_LogArray.size();
00037     for(uint i = 0; i < count; i++) {
00038         if((m_LogArray.point(i)).y() ==  OldID) {
00039             return  (m_LogArray.point(i)).x();
00040         }
00041     }
00042 
00043     return Uml::id_None;
00044 }
00045 
00046 IDChangeLog& IDChangeLog::operator+=(const IDChangeLog& Other) {
00047     //m_LogArray.putpoints(m_LogArray.size(), Other.m_LogArray.size(), Other)
00048     uint count = Other.m_LogArray.size();
00049     for(uint i = 0; i < count; i++) {
00050         addIDChange((Other.m_LogArray.point(i)).y(), (Other.m_LogArray.point(i)).x());
00051     }
00052 
00053     return *this;
00054 }
00055 
00056 void IDChangeLog::addIDChange(Uml::IDType OldID, Uml::IDType NewID) {
00057     uint pos;
00058     if(!findIDChange(OldID, NewID, pos)) {
00059         pos = m_LogArray.size();
00060         m_LogArray.resize(pos + 1);
00061         m_LogArray.setPoint(pos, NewID, OldID);
00062     } else {
00063         m_LogArray.setPoint(pos, NewID, OldID);
00064     }
00065 }
00066 
00067 Uml::IDType IDChangeLog::findOldID(Uml::IDType NewID) {
00068     uint count = m_LogArray.size();
00069     for(uint i = 0; i < count; i++) {
00070         if((m_LogArray.point(i)).x() ==  NewID) {
00071             return  (m_LogArray.point(i)).y();
00072         }
00073     }
00074 
00075     return Uml::id_None;
00076 }
00077 
00078 bool IDChangeLog::findIDChange(Uml::IDType OldID, Uml::IDType NewID, uint& pos) {
00079     uint count = m_LogArray.size();
00080     for(uint i = 0; i < count; i++) {
00081         if(((m_LogArray.point(i)).y() ==  OldID) && ((m_LogArray.point(i)).x() ==  NewID)) {
00082             pos = i;
00083             return  true;
00084         }
00085     }
00086 
00087     return false;
00088 }
00089 
00090 void IDChangeLog::removeChangeByNewID(Uml::IDType OldID) {
00091     uint count = m_LogArray.size();
00092     for(uint i = 0; i < count; i++) {
00093         if((m_LogArray.point(i)).y() ==  OldID) {
00094             m_LogArray.setPoint(i, Uml::id_None, OldID);
00095         }
00096     }
00097 }
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:57 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003