Exemplo n.º 1
0
		NodeBase CreateArithmeticNode(ArithmeticExpression exp)
		{
			NodeBase node = null;
			
			if (exp.HasSubExpression())
			{
				node = CreateMathNode(exp.GetSubExpression());
			}
			else
			{
				if (exp.GetValue().HasConstant())
				{
					node = new ConstantNode(m_Container);
					if (exp.GetValue().GetConstant().HasFloat2())
					{
						((ConstantNode)node).m_ConstantValue = (float)exp.GetValue().GetConstant().GetFloat2().Value;
						((ConstantNode)node).m_ConstantType = VariableType.FLOAT;
					}
					else if (exp.GetValue().GetConstant().HasInteger())
					{
						((ConstantNode)node).m_ConstantValue = (int)exp.GetValue().GetConstant().GetInteger().Value;
						((ConstantNode)node).m_ConstantType = VariableType.INT;
					}
					else if (exp.GetValue().GetConstant().HasBoolean())
					{
						((ConstantNode)node).m_ConstantValue = (bool)exp.GetValue().GetConstant().GetBoolean().Value;
						((ConstantNode)node).m_ConstantType = VariableType.BOOLEAN;
					}
					else if (exp.GetValue().GetConstant().HasString2())
					{
						((ConstantNode)node).m_ConstantValue = (string)exp.GetValue().GetConstant().GetString2().Value;
						((ConstantNode)node).m_ConstantType = VariableType.STRING;
					}
				}
				else
				{
					node = new VariableNode(m_Container);
					((VariableNode)node).m_VariableName = exp.GetValue().GetVariable().GetName().Value;
					((VariableNode)node).m_VariableType = (VariableType)exp.GetValue().GetVariable().GetType2().Value;
				}
			}
			
			return node;
		}