Warning, file /office/calligra/libs/main/KoFilterEdge.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the Calligra libraries
0002    Copyright (C) 2001 Werner Trobin <trobin@kde.org>
0003 
0004 This library is free software; you can redistribute it and/or
0005 modify it under the terms of the GNU Library General Public
0006 License as published by the Free Software Foundation; either
0007 version 2 of the License, or (at your option) any later version.
0008 
0009 This library is distributed in the hope that it will be useful,
0010 but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012 Library General Public License for more details.
0013 
0014 You should have received a copy of the GNU Library General Public License
0015 along with this library; see the file COPYING.LIB.  If not, write to
0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017 Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #include "KoFilterEdge.h"
0021 #include "KoFilterVertex.h"
0022 #include "PriorityQueue_p.h"
0023 
0024 namespace CalligraFilter {
0025 
0026 Edge::Edge(Vertex* vertex, KoFilterEntry::Ptr filterEntry) :
0027         m_vertex(vertex), m_filterEntry(filterEntry), d(0)
0028 {
0029 }
0030 
0031 void Edge::relax(const Vertex* predecessor, PriorityQueue<Vertex>& queue)
0032 {
0033     if (!m_vertex || !predecessor || !m_filterEntry)
0034         return;
0035     if (m_vertex->setKey(predecessor->key() + m_filterEntry->weight)) {
0036         queue.keyDecreased(m_vertex);   // maintain the heap property
0037         m_vertex->setPredecessor(predecessor);
0038     }
0039 }
0040 
0041 void Edge::dump(const QByteArray& indent) const
0042 {
0043     if (m_vertex)
0044         debugFilter << indent << "Edge -> '" << m_vertex->mimeType()
0045         << "' (" << m_filterEntry->weight << ")" << endl;
0046     else
0047         debugFilter << indent << "Edge -> '(null)' ("
0048         << m_filterEntry->weight << ")" << endl;
0049 }
0050 
0051 }