⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cluster.h

📁 支持简单的公式推导
💻 H
字号:
#ifndef __CLUSTER_H__
#define __CLUSTER_H__


#include "mynode.h"

string ModifyNumber(double in,const string& m,bool IsPrefix );
string ForConst(double in);
//string ForPower(const string& ,int times);


class Cluster:public Operand
{
public: // cast
    Cluster(const Node& me ); //向上接收Node类型!!!
	Cluster(double c =0){*this = Node(c);}
	Cluster(const string& str){*this = Node(str);}
	~Cluster(){};

	void Mul(const Cluster&);   //处理内务!!!
	void Div(const Cluster&);
public:
	
    virtual bool operator<(const Cluster& cl)const;
	
	
	
public://inline
	   	
	
    virtual string GetExpression()const
	{ return expression_;}
   
    double GetSingleValue()const
	{
		return node_map_.begin()->first.GetNodeValue();
	}

	virtual bool IsConst()const
	{
		return node_map_.size() == 1;
	}

    double GetConst()const
		{return node_map_.begin()->first.GetNodeValue();}
		
	
	
    map<Node,double>    node_map_;
	virtual Cluster& PowerBy(double);
private:
	string expression_;
	void UpdateAll();
	void SetOpposit();
    void ExpressionCut(string&);
	
protected:
	string GetFactor()const;
	void MergeWeight(const Cluster&);
	void ReverseWeight();
    int ReplaceByConst(const string&,double );
  
	friend class Block;
	//friend Block Power(const Block& lb,double p);
	
	//friend Cluster ClusterPower(const Cluster,double p);
};
    
#endif //__CLUSTER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -