private Guid GetQuestionId(IVariableNode variableNodeId) { var question = m_domainItemLocator .GetAll <IQuestionNode>() .FirstOrDefault(x => x.QuestionName == variableNodeId.VariableName); if (question == null || !m_lookup.Exists(question.Id)) { throw new ArgumentException($@"variable node '{variableNodeId.DisplayName}' variable not initialized"); } return(question.Id); }
private void CheckIdentifierExists(IdentifierNode idNode) { if (!symbolTable.Exists(idNode.Value)) { logger.LogError("Use of undeclared identifier {Identifier}", idNode.Value); } }
public decimal GetNumberValue(string variableName) { var variableId = GetQuestionNode(variableName).Id; if (m_symbolTable.Exists <int>(variableId)) { return(m_symbolTable.Lookup <int>(variableId)); } if (m_symbolTable.Exists <decimal>(variableId)) { return(m_symbolTable.Lookup <decimal>(variableId)); } throw new ArgumentException(nameof(variableName), $"question {variableName} used as numeric but is not"); }