本文整理汇总了C#中DataDictionary.Interpreter.InterpretationContext类的典型用法代码示例。如果您正苦于以下问题:C# InterpretationContext类的具体用法?C# InterpretationContext怎么用?C# InterpretationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InterpretationContext类属于DataDictionary.Interpreter命名空间,在下文中一共展示了InterpretationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InsertInListChange
/// <summary>
/// Constructor
/// </summary>
/// <param name="context"></param>
/// <param name="statement"></param>
/// <param name="variable"></param>
/// <param name="explanation"></param>
public InsertInListChange(InterpretationContext context, InsertStatement statement, IVariable variable, ExplanationPart explanation)
: base(variable, null, null)
{
Context = context;
Statement = statement;
Explanation = explanation;
}
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:14,代码来源:InsertInListChange.cs
示例2: Evaluate
/// <summary>
/// Provides the value of the function
/// </summary>
/// <param name="context"></param>
/// <param name="actuals">the actual parameters values</param>
/// <param name="explain"></param>
/// <returns>The value for the function application</returns>
public override IValue Evaluate(InterpretationContext context, Dictionary<Actual, IValue> actuals,
ExplanationPart explain)
{
IValue retVal = null;
int token = context.LocalScope.PushContext();
AssignParameters(context, actuals);
ListValue value = context.FindOnStack(Collection) as ListValue;
if (value != null)
{
Collection collectionType = value.Type as Collection;
if (collectionType != null && collectionType.Type != null)
{
Type elementType = collectionType.Type;
if (value.Val.Count >= collectionType.getMaxSize())
{
AddError("Cannot allocate element in list : list full");
}
else
{
retVal = elementType.DefaultValue;
value.Val.Add(retVal);
}
}
}
context.LocalScope.PopContext(token);
return retVal;
}
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:38,代码来源:Allocate.cs
示例3: Evaluate
/// <summary>
/// Provides the value of the function.
/// The function returns true if the string passes the check.
/// </summary>
/// <param name="context"></param>
/// <param name="actuals">the actual parameters values</param>
/// <param name="explain"></param>
/// <returns>The value for the function application</returns>
public override IValue Evaluate(InterpretationContext context, Dictionary<Actual, IValue> actuals,
ExplanationPart explain)
{
IValue retVal = EFSSystem.BoolType.False;
int token = context.LocalScope.PushContext();
AssignParameters(context, actuals);
StringValue number = context.findOnStack(Number).Value as StringValue;
if (number != null && number.Val != "")
{
char[] tmp = number.Val.ToCharArray();
// Each character in the string is checked. The expected format is
// #########FFFFF
// ie. a sequence of digits, possibly followed by a sequence of 'F'.
// numbersequence indicates that we are in the first part of the string
bool numberSequence = true;
for (int i = 0; i < tmp.Length; i++)
{
// If we encounter a letter that is not F, the value is incorrect
if (Char.IsLetter(tmp[i]) && !tmp[i].Equals('F'))
{
break;
}
// If we encounter a number after the first 'F' character, the value is incorrect
if (!numberSequence && Char.IsDigit(tmp[i]))
{
break;
}
if (Char.IsLetter(tmp[i]))
{
numberSequence = false;
}
// Once the whole string has been checked without error, set the return to true
if (i == tmp.Length - 1)
{
retVal = EFSSystem.BoolType.True;
}
}
}
context.LocalScope.PopContext(token);
return retVal;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:58,代码来源:CheckNumber.cs
示例4: Evaluate
/// <summary>
/// Provides the value of the function
/// </summary>
/// <param name="context"></param>
/// <param name="actuals">the actual parameters values</param>
/// <param name="explain"></param>
/// <returns>The value for the function application</returns>
public override IValue Evaluate(InterpretationContext context, Dictionary<Actual, IValue> actuals,
ExplanationPart explain)
{
IValue retVal = EFSSystem.BoolType.False;
int token = context.LocalScope.PushContext();
AssignParameters(context, actuals);
if (context.FindOnStack(Element).Value != EFSSystem.EmptyValue)
{
retVal = EFSSystem.BoolType.True;
}
context.LocalScope.PopContext(token);
return retVal;
}
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:24,代码来源:Available.cs
示例5: Evaluate
/// <summary>
/// Provides the value of the function
/// </summary>
/// <param name="context"></param>
/// <param name="actuals">the actual parameters values</param>
/// <param name="explain"></param>
/// <returns>The value for the function application</returns>
public override IValue Evaluate(InterpretationContext context, Dictionary<Actual, IValue> actuals,
ExplanationPart explain)
{
IValue retVal = null;
int token = context.LocalScope.PushContext();
AssignParameters(context, actuals);
DoubleValue value = context.findOnStack(Value).Value as DoubleValue;
if (value != null)
{
int res = (int) Math.Round(value.Val);
retVal = new IntValue(ReturnType, res);
}
context.LocalScope.PopContext(token);
return retVal;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:26,代码来源:DoubleToInteger.cs
示例6: Evaluate
/// <summary>
/// Provides the value of the function
/// </summary>
/// <param name="context"></param>
/// <param name="actuals">the actual parameters values</param>
/// <param name="explain"></param>
/// <returns>The value for the function application</returns>
public override IValue Evaluate(InterpretationContext context, Dictionary<Actual, IValue> actuals,
ExplanationPart explain)
{
IValue retVal = null;
int token = context.LocalScope.PushContext();
AssignParameters(context, actuals);
BoolValue val = context.findOnStack(Value).Value as BoolValue;
if (val != null)
{
if (val.Val)
{
retVal = EFSSystem.BoolType.False;
}
else
{
retVal = EFSSystem.BoolType.True;
}
}
context.LocalScope.PopContext(token);
return retVal;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:30,代码来源:Not.cs
示例7: Evaluate
/// <summary>
/// Provides the value of the function
/// </summary>
/// <param name="context"></param>
/// <param name="actuals">the actual parameters values</param>
/// <param name="explain"></param>
/// <returns>The value for the function application</returns>
public override IValue Evaluate(InterpretationContext context, Dictionary<Actual, IValue> actuals,
ExplanationPart explain)
{
IValue retVal = null;
int token = context.LocalScope.PushContext();
AssignParameters(context, actuals);
ListValue value = context.FindOnStack(Collection) as ListValue;
if (value != null)
{
Collection collectionType = value.Type as Collection;
if (collectionType != null && collectionType.Type != null)
{
Type elementType = collectionType.Type;
int i = 0;
while (i < value.Val.Count && value.Val[i] != EFSSystem.EmptyValue)
{
i += 1;
}
if (i < value.Val.Count)
{
retVal = elementType.DefaultValue;
value.Val[i] = retVal;
}
else
{
AddError("Cannot allocate element in list : list full");
}
}
}
context.LocalScope.PopContext(token);
return retVal;
}
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:44,代码来源:Allocate.cs
示例8: GetValue
/// <summary>
/// Provides the value associated to this Expression
/// </summary>
/// <param name="context">The context on which the value must be found</param>
/// <param name="explain">The explanation to fill, if any</param>
/// <returns></returns>
protected internal override IValue GetValue(InterpretationContext context, ExplanationPart explain)
{
StructureValue retVal = null;
Structure structureType = Structure.GetExpressionType() as Structure;
if (structureType != null)
{
retVal = new StructureValue(this, context, explain);
}
else
{
AddError("Cannot determine structure type for " + ToString());
}
return retVal;
}
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:22,代码来源:StructExpression.cs
示例9: GetCalled
/// <summary>
/// Provides the ICallable designated by this designator according to the interpretation context
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public ICallable GetCalled(InterpretationContext context)
{
ICallable retVal = GetReference(context) as ICallable;
if (retVal == null)
{
Type type = GetDesignatorType();
if (type != null)
{
retVal = type.CastFunction;
}
}
return retVal;
}
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:20,代码来源:Designator.cs
示例10: GetValue
/// <summary>
/// Provides the value associated to this Expression
/// </summary>
/// <param name="context">The context on which the value must be found</param>
/// <param name="explain">The explanation to fill, if any</param>
/// <returns></returns>
protected internal override IValue GetValue(InterpretationContext context, ExplanationPart explain)
{
IValue retVal = null;
if (Term != null)
{
retVal = Term.GetValue(context, explain);
}
else
{
if (Not.Equals(UnaryOp))
{
BoolValue b = Expression.GetValue(context, explain) as BoolValue;
if (b != null)
{
if (b.Val)
{
retVal = EfsSystem.Instance.BoolType.False;
}
else
{
retVal = EfsSystem.Instance.BoolType.True;
}
}
else
{
AddError("Expression " + Expression + " does not evaluate to boolean");
}
}
else if (Minus.Equals(UnaryOp))
{
IValue val = Expression.GetValue(context, explain);
IntValue intValue = val as IntValue;
if (intValue != null)
{
retVal = new IntValue(intValue.Type, -intValue.Val);
}
else
{
DoubleValue doubleValue = val as DoubleValue;
if (doubleValue != null)
{
retVal = new DoubleValue(doubleValue.Type, -doubleValue.Val);
}
}
if (retVal == null)
{
AddError("Cannot negate value for " + Expression);
}
}
else
{
retVal = Expression.GetValue(context, explain);
}
}
return retVal;
}
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:65,代码来源:UnaryExpression.cs
示例11: GetValue
/// <summary>
/// Provides the value associated to this Expression
/// </summary>
/// <param name="context">The context on which the value must be found</param>
/// <returns></returns>
public override Values.IValue GetValue(InterpretationContext context)
{
return Value;
}
开发者ID:Assmann-Siemens,项目名称:ERTMSFormalSpecs,代码行数:9,代码来源:NumberExpression.cs
示例12: createSurface
/// <summary>
/// Provides the surface of this function if it has been statically defined
/// </summary>
/// <param name="context">the context used to create the surface</param>
/// <param name="xParam">The X axis of this surface</param>
/// <param name="yParam">The Y axis of this surface</param>
/// <param name="explain"></param>
/// <returns>The surface which corresponds to this expression</returns>
public override Surface createSurface(InterpretationContext context, Parameter xParam, Parameter yParam,
ExplanationPart explain)
{
Surface retVal = base.createSurface(context, xParam, yParam, explain);
retVal = Surface.createSurface(GetValue(context, explain), xParam, yParam);
if (retVal == null)
{
throw new Exception("Cannot create surface for " + ToString());
}
retVal.XParameter = xParam;
retVal.YParameter = yParam;
return retVal;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:24,代码来源:DerefExpression.cs
示例13: GetVariable
/// <summary>
/// Provides the variable referenced by this expression, if any
/// </summary>
/// <param name="context">The context on which the variable must be found</param>
/// <returns></returns>
public override IVariable GetVariable(InterpretationContext context)
{
IVariable retVal = null;
if (Term != null)
{
retVal = Term.GetVariable(context);
}
else if (Expression != null && UnaryOp == null)
{
// ReSharper disable once RedundantAssignment
retVal = null;
}
else
{
AddError("Cannot get variable from expression" + ToString());
}
return retVal;
}
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:25,代码来源:UnaryExpression.cs
示例14: additionalChecks
/// <summary>
/// Perform additional checks based on the parameter type
/// </summary>
/// <param name="root">The element on which the errors should be reported</param>
/// <param name="context">The evaluation context</param>
/// <param name="actualParameters">The parameters applied to this function call</param>
public override void additionalChecks(ModelElement root, InterpretationContext context,
Dictionary<string, Expression> actualParameters)
{
CheckFunctionalParameter(root, context, actualParameters[Targets.Name], 1);
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:11,代码来源:Discontinuities.cs
示例15: GetVariable
/// <summary>
/// Provides the variable designated by this designator according to the interpretation context
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public IVariable GetVariable(InterpretationContext context)
{
INamable reference = GetReference(context);
IVariable retVal = reference as IVariable;
return retVal;
}
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:11,代码来源:Designator.cs
示例16: GetVariable
/// <summary>
/// Provides the variable referenced by this expression, if any
/// </summary>
/// <param name="context">The context on which the variable must be found</param>
/// <param name="explain"></param>
/// <returns></returns>
public override IVariable GetVariable(InterpretationContext context)
{
INamable current = null;
InterpretationContext ctxt = new InterpretationContext(context);
for (int i = 0; i < Arguments.Count; i++)
{
if (current != null)
{
// Current can be null on several loop iterations when the referenced element
// does not references a variable (for instance, when it references a namespace)
ctxt.Instance = current;
}
current = Arguments[i].GetVariable(ctxt);
if (current == null)
{
current = Arguments[i].GetValue(ctxt, null);
}
}
return current as IVariable;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:28,代码来源:DerefExpression.cs
示例17: Evaluate
/// <summary>
/// Provides the value of the function
/// </summary>
/// <param name="context"></param>
/// <param name="actuals">the actual parameters values</param>
/// <param name="explain"></param>
/// <returns>The value for the function application</returns>
public override IValue Evaluate(InterpretationContext context, Dictionary<Actual, IValue> actuals,
ExplanationPart explain)
{
IValue retVal = null;
int token = context.LocalScope.PushContext();
AssignParameters(context, actuals);
StructureValue startDate = context.findOnStack(StartDate).Value as StructureValue;
if (startDate != null)
{
int year = GetIntValue(startDate, "Year");
int month = GetIntValue(startDate, "Month");
int day = GetIntValue(startDate, "Day");
int hour = GetIntValue(startDate, "Hour");
int minute = GetIntValue(startDate, "Minute");
int second = GetIntValue(startDate, "Second");
int tts = GetIntValue(startDate, "TTS");
DoubleValue addedTime = context.findOnStack(Increment).Value as DoubleValue;
if (addedTime != null)
{
DateTime start = new DateTime(year, month, day, hour, minute, second, tts);
DateTime currentTime = start.AddSeconds((double) addedTime.Val);
retVal = GetEFSDate(currentTime, startDate.Type as Structure);
}
}
context.LocalScope.PopContext(token);
return retVal;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:40,代码来源:AddToDate.cs
示例18: GetValue
/// <summary>
/// Provides the value associated to this Expression
/// </summary>
/// <param name="context">The context on which the value must be found</param>
/// <param name="explain">The explanation to fill, if any</param>
/// <returns></returns>
public override IValue GetValue(InterpretationContext context, ExplanationPart explain)
{
INamable retVal = Ref as IValue;
if (retVal == null)
{
InterpretationContext ctxt = new InterpretationContext(context);
for (int i = 0; i < Arguments.Count; i++)
{
if (retVal != null)
{
ctxt.Instance = retVal;
}
retVal = Arguments[i].GetValue(ctxt, explain);
if (retVal == EFSSystem.EmptyValue)
{
break;
}
}
}
if (retVal == null)
{
AddError(ToString() + " does not refer to a value");
}
return retVal as IValue;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:35,代码来源:DerefExpression.cs
示例19: GetPrefixValue
/// <summary>
/// Provides the value of the prefix of the expression
/// </summary>
/// <param name="context">The context on which the value must be found</param>
/// <param name="elementCount">The number of elements to consider</param>
/// <param name="explain"></param>
/// <returns></returns>
public INamable GetPrefixValue(InterpretationContext context, int elementCount, ExplanationPart explain)
{
INamable retVal = null;
InterpretationContext ctxt = new InterpretationContext(context);
for (int i = 0; i < elementCount; i++)
{
if (retVal != null)
{
ctxt.Instance = retVal;
}
retVal = Arguments[i].GetValue(ctxt, explain);
if (retVal == null)
{
retVal = Arguments[i].Ref;
}
if (retVal == EFSSystem.EmptyValue)
{
break;
}
}
if (retVal == null)
{
AddError(ToString() + " prefix does not refer to a value");
}
return retVal;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:37,代码来源:DerefExpression.cs
示例20: getCalled
/// <summary>
/// Provides the callable that is called by this expression
/// </summary>
/// <param name="context"></param>
/// <param name="explain"></param>
/// <returns></returns>
public override ICallable getCalled(InterpretationContext context, ExplanationPart explain)
{
ICallable retVal = Called;
if (retVal == null)
{
AddError("Cannot evaluate call to " + ToString());
}
return retVal;
}
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:17,代码来源:DerefExpression.cs
注:本文中的DataDictionary.Interpreter.InterpretationContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论