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


C++ ExpressionNode::getVariable方法代码示例

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


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

示例1: operation

ExpressionNode::ExpressionNode(const ExpressionNode & other): //copy constructor
type(other.getType()), operation(other.getOperation()), activechildren(other.getOperation()->getArity()),
right(0), firstChild(0), variable(other.getVariable()), value(other.getValue())
{
	setRight(other.getRight());
	setFirstChild(other.getFirstChild()); // automatically also sets other children
}
开发者ID:vk-eipi,项目名称:MathParser,代码行数:7,代码来源:expression.cpp

示例2: replace

void ExpressionNode::replace(const ExpressionNode &newNode)
{
	std::clog << "...<replacing> "  << *this << " with " << newNode << std::endl;
	
	//ExpressionNode *curOld;
	//ExpressionNode *curNew;
	
	setType(newNode.getType());
	setOperation(newNode.getOperation());
//	setRight(newNode.getRight());
	setFirstChild(newNode.getFirstChild()); // automatically also sets other children
	//curOld = firstChild;
	//curNew = newNode.getFirstChild();
	
	//while (curNew != 0)
	//{
		//curOld->setRight(curNew->getRight());
		//curOld = curOld->getRight();
		//curNew = curNew->getRight();
	//}
	setVariable(newNode.getVariable());
	setValue(newNode.getValue());
	
	std::clog << "...</replacing>" << std::endl;
}
开发者ID:vk-eipi,项目名称:MathParser,代码行数:25,代码来源:expression.cpp

示例3: isCompatible

bool Multiplication::isCompatible(const ExpressionNode& left, const ExpressionNode& right)
{
	if (left.getType() == NUMBER && right.getType() == NUMBER)
	{
		return true;
	}
	else if (left.getType() == VARIABLE && right.getType() == VARIABLE)
	{
		if (left.getVariable() == right.getVariable())
		{
			return true;
		}
	}
	else if (left.getType() == OPERATION)
	{
		if (left.getOperation() == &ADDITION || left.getOperation() == &SUM)
		{
			return true;
		}
		else if (left.getOperation() == &MULTIPLICATION || left.getOperation() == &PRODUCT)
		{
			return true;
		}
	}
	else if (right.getType() == OPERATION)
	{
		if (right.getOperation() == &ADDITION || right.getOperation() == &SUM)
		{
			return true;
		}
		else if (right.getOperation() == &MULTIPLICATION || right.getOperation() == &PRODUCT)
		{
			return true;
		}
	}
	
	return false;
}
开发者ID:vk-eipi,项目名称:MathParser,代码行数:38,代码来源:operation.cpp

示例4:

bool ExpressionNode::operator== (const ExpressionNode& other) const
{
	ExpressionNode *selfptr;
	ExpressionNode *otherptr;
	
	if (getType() == other.getType() && 
		getOperation() == other.getOperation() && 
		getVariable() == other.getVariable() &&
		getValue() == other.getValue() )
	{
		selfptr = firstChild;
		otherptr = other.getFirstChild();
		while (selfptr != 0 && otherptr != 0)
		{
			if (*selfptr == *otherptr)
			{
				selfptr = selfptr->getRight();
				otherptr = otherptr->getRight();
			}
			else
			{
				return false;
			}
		}
		if (selfptr == 0 && otherptr == 0)
		{
			return true;
		}
		else
		{
			assert(selfptr != otherptr);
			return false;
		}
	}
	else
	{	
		return false;
	}
}
开发者ID:vk-eipi,项目名称:MathParser,代码行数:39,代码来源:expression.cpp


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