当前位置: 首页>>代码示例>>C++>>正文


C++ Formula::type方法代码示例

本文整理汇总了C++中Formula::type方法的典型用法代码示例。如果您正苦于以下问题:C++ Formula::type方法的具体用法?C++ Formula::type怎么用?C++ Formula::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Formula的用法示例。


在下文中一共展示了Formula::type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateVariableProperties

bool CreateVariableProperties(UdmDesertMap& des_map, DesertUdmMap &inv_des_map, UdmElementSet& elements)
{
	UdmElementSet::iterator i;
	//progress bar indication
	CDesertStatusDlg * st_dlg = GetStatusDlg(NULL);
	int pos = 0;
	
	for (i = elements.begin(); i != elements.end(); i++)
	{
		Element e= *i;
		std::string ename = e.name();
		set<VariableProperty> vp_set = e.VariableProperty_kind_children();
		set<VariableProperty>::iterator vp_i;
		for (vp_i = vp_set.begin(); vp_i != vp_set.end(); vp_i++)
		{
			VariableProperty vp = *vp_i;
			std::string nnvp = vp.name();
			long owner_id = GetID(e, des_map);
	
			if(!vp.parametric())
			{		
				Domain vp_d = vp.domain();
				long domain_id = GetID(vp_d, des_map);
				CString cpfn;
				if ( strcmp(((string)vp.PCM_STR()).c_str() , "PCM_CUST") )
				{
					//no match
					cpfn = ((string)vp.PCM_STR()).c_str();
				}
				else cpfn = ((string)vp.CUSTName()).c_str();
			
				long vp_id = CreateVariableProperty(
					utf82cstring((string)vp.name()),	//const char *name, 
					(LPCTSTR)cpfn,					//const char *cpfn
					owner_id,						//long owner, 
					domain_id );					//long domain);
			
				/*
			
				long vp_id = CreateVariableProperty(
					((string)vp.name()).c_str(),	//const char *name, 
					(LPCTSTR)cpfn,					//const char *cpfn
					owner_id,						//long owner, 
					domain_id,						//long domain);
					vp.id(),
					vp.externalID());
				*/
				DoMap(vp, des_map, inv_des_map, vp_id);
				TRACE("Added VariableProperty: (name %s, owner: %d, domain: %d) :%d\n", 
						((string)vp.name()).c_str(),
						owner_id,
						domain_id,
						long(vp_id));
			}
			else  //parametric
			{
				set<Formula> fs = vp.formula_end();
				for(set<Formula>::iterator fit = fs.begin();fit!=fs.end();++fit)
				{
					Formula currf = *fit;
					if(currf.type()==CustomFormula::meta)
					{
						CustomFormula customf = CustomFormula::Cast(currf);
						long pvp_id = createParametricVariableProperty(utf82cstring((string)vp.name()), owner_id, utf82cstring((string)customf.expression()));
						DoMap(vp, des_map, inv_des_map, pvp_id);
						TRACE("Added VariableProperty: (name %s, owner: %d, domain: %d) :%d\n", 
								((string)vp.name()).c_str(),
								owner_id,
								long(pvp_id));
					}
					else
					{
						SimpleFormula simplef = SimpleFormula::Cast(currf);
						CString cpfn = ((string)simplef.ComputationType()).c_str();
						long vp_id = CreateVariableProperty(
							utf82cstring((string)vp.name()),	//const char *name, 
									(LPCTSTR)cpfn,					//const char *cpfn
									owner_id						//long owner, 
									);					
			
		
						DoMap(vp, des_map, inv_des_map, vp_id);
						TRACE("Added VariableProperty: (name %s, owner: %d) :%d\n", ((string)vp.name()).c_str(), owner_id,long(vp_id));
					}
				}		
			}
		};//eo for(vp_i)
		//progress bar status update
		pos++;
		//st_dlg->StepInState((short) (float)pos *100.00 /(float)elements.size());

	};//end for(i)

	return true;
};
开发者ID:neemask,项目名称:meta-core,代码行数:95,代码来源:DesMap.cpp

示例2: operator

std::wstring Writer::operator ()(const Formula &formula, const Dictionary &dictionary, SymbolType *symbolType) const
{
    SymbolType localSymbolType;
    SymbolType &type = symbolType ? *symbolType : localSymbolType;
    std::wstring result;

    type = formula.type();

    switch (type) {
    case NONE_SYMBOL:
        return symbolic.noneSymbol;

        break;

    case FALSE_SYMBOL:
        return symbolic.falseSymbol;

        break;

    case TRUE_SYMBOL:
        return symbolic.trueSymbol;

        break;

    case EQUALITY:
        if (formula.terms().size()<=1) {
            return symbolic.trueSymbol;
        }

        result += operator ()(formula.terms()[0], dictionary);

        for (size_t i = 1; i < formula.terms().size(); ++i) {
            result += symbolic.equalitySymbol;
            result += operator ()(formula.terms()[i], dictionary);
        }

        break;

    case NONEQUALITY:
        if (formula.terms().size()<=1) {
            return symbolic.trueSymbol;
        }

        if (formula.terms().size()==2) {
            result += (*this)(formula.terms()[0], dictionary);
            result += symbolic.nonequalitySymbol;
            result += (*this)(formula.terms()[1], dictionary);
        } else {
            result += symbolic.nonequalitySymbol+symbolic.leftRelationBracket;

            for (size_t i = 0; i<formula.terms().size(); ++i) {
                if (i!=0) {
                    result += symbolic.relationSeparatorSymbol;
                    result += (*this)(formula.terms()[i], dictionary);
                }
            }

            result += symbolic.rightRelationBracket;
        }

        break;

    case RELATION:
        result = dictionary(formula.symbol());

        if (result.empty()) {
            result = relationName(formula.symbol().id);
        }

        result += symbolic.leftRelationBracket;

        if (formula.terms().empty() == false) {
            result += operator ()(formula.terms()[0], dictionary);

            for (size_t i = 1; i < formula.terms().size(); ++i) {
                result += symbolic.relationSeparatorSymbol;
                result += operator ()(formula.terms()[i], dictionary);
            }
        }

        result += symbolic.rightRelationBracket;

        break;

    case NEGATION:
        result = operator ()(formula.formulas()[0], dictionary, &type);
        insertBracketsIfNeeded(formula.type(), type, result);
        type = formula.type();
        result = symbolic.negationSymbol+result;

        break;

    case CONJUNCTION: case DISJUNCTION:
        switch (formula.formulas().size()) {
        case 0:
            if (type == CONJUNCTION) {
                result = symbolic.trueSymbol;
                type = TRUE_SYMBOL;
            } else {
                result = symbolic.falseSymbol;
//.........这里部分代码省略.........
开发者ID:recursivelab,项目名称:FunnyProof,代码行数:101,代码来源:readwrite.cpp


注:本文中的Formula::type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。