cimforreduceloss/testHasttable/elementreduction.h

32 lines
1.1 KiB
C
Raw Normal View History

#ifndef ELEMENTREDUCTION_H
#define ELEMENTREDUCTION_H
#include <QList>
#include <QHash>
#include <QString>
#include <QVector>
#include <QDomElement>
#include <QDomDocument>
#include <QDomNodeList>
#include <QDomNode>
#include <QStringList>
#include "element/commontype.h"
//把电阻等于0的元件都去掉
class ElementReduction
{
public:
explicit ElementReduction(const QList<BranchStruc*>& branchList);
void doIt();
~ElementReduction();
private:
void merge(QDomElement &element, QHash<QString,BranchStruc *>& idToBranch);
void buildTree(QDomElement &element, QDomDocument &root, QHash<QString,QVector<BranchStruc *> >& linkage, QHash<QString,BranchStruc *>& idToBranch);
void buildTree2(QDomElement &element, QDomDocument &root, QHash<QString,QVector<BranchStruc *> >& linkage, QHash<QString,BranchStruc *>& idToBranch);
void visit(BranchStruc* branch, QHash<QString, QVector<BranchStruc *> > &linkage);
void visit2(BranchStruc* branch, QHash<QString, QVector<BranchStruc *> > &linkage);
const QList<BranchStruc*>& branchList;
QHash<QString,char> visited;
};
#endif // ELEMENTREDUCTION_H