本文整理汇总了C#中HeD.Engine.Model.ASTNode类的典型用法代码示例。如果您正苦于以下问题:C# ASTNode类的具体用法?C# ASTNode怎么用?C# ASTNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASTNode类属于HeD.Engine.Model命名空间,在下文中一共展示了ASTNode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Translate
public object Translate(TranslationContext context, ASTNode node)
{
var result = new SQLModel.TableExpression();
var sqlContext = (SQLTranslationContext)context;
result.TableName = sqlContext.GetExpressionObjectName(String.Format("{0}.{1}", node.GetAttribute<string>("libraryName", sqlContext.ArtifactName), node.GetAttribute<string>("name")));
// If the expression being referenced is scalar, it will be automatically promoted to a query by the expression def translation
// In this case, it must be demoted back to a scalar expression with a subquery access.
if (!(node.ResultType is ListType) && !(node.ResultType is ObjectType))
{
var selectExpression = new SQLModel.SelectExpression();
selectExpression.SelectClause = new SQLModel.SelectClause();
selectExpression.SelectClause.Columns.Add(new SQLModel.ColumnExpression(new SQLModel.QualifiedFieldExpression("value")));
selectExpression.FromClause = new SQLModel.CalculusFromClause(new SQLModel.TableSpecifier(result));
// If the result type is also boolean, the expression will be converted to a 1 or 0, so it must be demoted back to an actual boolean-valued expression
if (DataTypes.Equal(node.ResultType, DataTypes.Boolean))
{
return SQLTranslationUtilities.DemoteBooleanValuedExpression(selectExpression);
}
return selectExpression;
}
return result;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:26,代码来源:Translators.cs
示例2: InternalVerify
protected virtual void InternalVerify(VerificationContext context, ASTNode node)
{
foreach (var child in node.Children)
{
Verifier.Verify(context, child);
}
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:7,代码来源:Verifiers.cs
示例3: TranslateCriteria
private CREFModel.DynamicRuleDynamicRuleCriteria TranslateCriteria(TranslationContext context, ASTNode condition)
{
var result = new CREFModel.DynamicRuleDynamicRuleCriteria();
result.Item = context.TranslateNode(condition);
return result;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:8,代码来源:CREFTranslator.cs
示例4: ReadNode
public static Node ReadNode(XElement element)
{
var nodeName = element.Name.LocalName;
var nodeType = element.GetSchemaInfo().SchemaType;
Node result = null;
ASTNode astResult = null;
if (IsExpression(nodeType))
{
astResult = new ASTNode();
result = astResult;
}
else
{
result = new Node();
}
result.Name = nodeName;
result.NodeType = nodeType.QualifiedName.ToString();
var lineInfo = element as IXmlLineInfo;
if (lineInfo != null && lineInfo.HasLineInfo())
{
result.Line = lineInfo.LineNumber;
result.LinePos = lineInfo.LinePosition;
}
result.Attributes = new Dictionary<string, object>();
foreach (var a in element.Attributes())
{
var schemaInfo = a.GetSchemaInfo();
if (schemaInfo != null && schemaInfo.SchemaType != null && schemaInfo.SchemaType.QualifiedName != null && schemaInfo.SchemaType.QualifiedName.Name == "QName")
{
result.Attributes.Add(a.Name.LocalName, element.ExpandName(a.Value));
}
else
{
result.Attributes.Add(a.Name.LocalName, a.Value);
}
}
result.Children = new List<Node>();
foreach (var e in element.Elements())
{
if (e.Name.LocalName == "description" && astResult != null)
{
astResult.Description = e.Value;
}
else
{
result.Children.Add(ReadNode(e));
}
}
return result;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:56,代码来源:NodeReader.cs
示例5: Verify
public void Verify(VerificationContext context, ASTNode node)
{
var expressionType = context.ResolveExpressionRef(node.GetAttribute<string>("libraryName"), node.GetAttribute<string>("name"));
if (expressionType.Expression.ResultType == null)
{
throw new InvalidOperationException("Invalid forward reference.");
}
node.ResultType = expressionType.Expression.ResultType;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:10,代码来源:Verifiers.cs
示例6: TranslateCodeReference
protected object TranslateCodeReference(TranslationContext context, ObjectType sourceType, ASTNode node, string path)
{
// Reference the Codes property with a First expression
var result = GetPropertyExpression(context, node, "Codes");
result = GetFirstExpression(context, result);
// TODO: Issue a warning that an arbitrary Code is being selected
return result;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:11,代码来源:ModelTranslators.cs
示例7: GetPropertyExpression
protected object GetPropertyExpression(TranslationContext context, ASTNode node, string path)
{
var result = new SQLModel.PropertyExpression();
result.Path = path;
if (node.Children.Count > 0)
{
result.Item = context.TranslateNode(node.Children[0]);
}
return result;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:12,代码来源:ModelTranslators.cs
示例8: Translate
public object Translate(TranslationContext context, ASTNode node)
{
var result = new CREFModel.BinaryExpression();
result.Operator = GetOperator();
result.OperatorSpecified = true;
foreach (var child in node.Children)
{
result.Items.Add(context.TranslateNode(child));
}
return result;
}
开发者ID:suesse,项目名称:healthedecisions,代码行数:13,代码来源:Translators.cs
示例9: Verify
public static void Verify(VerificationContext context, ASTNode node)
{
try
{
var verifier = NodeVerifierFactory.GetHandler(node.NodeType);
// Traversal occurs within the verify, because traversal may happen differently depending on the operation.
verifier.Verify(context, node);
}
catch (Exception e)
{
context.ReportMessage(e, node);
}
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:14,代码来源:Verifier.cs
示例10: GetResultType
protected override DataType GetResultType(ASTNode node)
{
var listType = node.ResultType as ListType;
if (!(listType.ElementType is IntervalType))
{
throw new InvalidOperationException("Collapse operator must be invoked on a list of intervals.");
}
return listType;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:10,代码来源:Verifiers.cs
示例11: TransformModelPath
public object TransformModelPath(ObjectType type, ASTNode node, string path)
{
var translator = ModelTranslatorFactory.GetHandler(type.Name);
return translator.TransformModelPath(this, type, node, path);
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:6,代码来源:TranslationContext.cs
示例12: TranslateNode
public object TranslateNode(ASTNode node)
{
var translator = NodeTranslatorFactory.GetHandler(node.NodeType);
return translator.Translate(this, node);
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:6,代码来源:TranslationContext.cs
示例13: TranslateCondition
private Model.Statement TranslateCondition(SQLTranslationContext context, string artifactName, string conditionName, ASTNode condition)
{
var result = new SQLModel.CreateViewStatement();
result.ViewName = context.GetExpressionObjectName(String.Format("{0}.{1}", artifactName, conditionName));
result.Expression = SQLTranslationUtilities.EnsureSelectExpression(context.TranslateNode(condition));
return result;
}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:7,代码来源:SQLTranslator.cs
注:本文中的HeD.Engine.Model.ASTNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论