cimforreduceloss/testHasttable/elementreduction.h

30 lines
965 B
C++

#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 buildTreeTo(QDomElement &element, QDomDocument &root, QHash<QString,QVector<BranchStruc *> >& linkage, QHash<QString,BranchStruc *>& idToBranch);
void buildTreeFrom(QDomElement &element, QDomDocument &root, QHash<QString,QVector<BranchStruc *> >& linkage, QHash<QString,BranchStruc *>& idToBranch);
const QList<BranchStruc*>& branchList;
QHash<QString,char> visited;
};
#endif // ELEMENTREDUCTION_H