/// <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; Call calledFunction = Called as Call; if (calledFunction != null) { retVal = Called.GetValue(context, explain) as ICallable; } else { retVal = Called.GetCalled(context, explain); if (retVal == null) { Type type = Called.GetExpressionType(); if (type != null) { retVal = type.CastFunction; } if (retVal == null) { retVal = Called.GetValue(context, explain) as ICallable; } } } return(retVal); }
public override string ToString() { string retVal = Called.ToString() + "("; bool first = true; foreach (Expression argument in ActualParameters) { if (!first) { retVal += ", "; } first = false; retVal += argument.ToString(); } foreach (KeyValuePair <string, Expression> pair in NamedActualParameters) { if (!first) { retVal += ", "; } first = false; retVal += pair.Key.ToString() + " => " + pair.Value.ToString(); } retVal = retVal + ")"; return(retVal); }
/// <summary> /// Provides the callable that is called by this expression /// </summary> /// <param name="namable"></param> /// <returns></returns> public override ICallable getCalled(InterpretationContext context) { ICallable retVal = null; Call calledFunction = Called as Call; if (calledFunction != null) { retVal = Called.GetValue(context) as ICallable; } else { retVal = Called.getCalled(context); if (retVal == null) { Types.Range range = Called.GetExpressionType() as Types.Range; if (range != null) { retVal = range.CastFunction; } if (retVal == null) { retVal = Called.GetValue(context) as ICallable; } } } return(retVal); }
/// <summary> /// Creates the graph associated to this expression, when the given parameter ranges over the X axis /// </summary> /// <param name="context">The interpretation context</param> /// <param name="parameter">The parameters of *the enclosing function* for which the graph should be created</param> /// <returns></returns> public override Functions.Graph createGraph(InterpretationContext context, Parameter parameter) { Functions.Graph retVal = base.createGraph(context, parameter); Functions.PredefinedFunctions.Cast cast = Called.Ref as Functions.PredefinedFunctions.Cast; if (cast != null) { // In case of cast, just take the graph of the enclosed expression Parameter param = (Parameter)cast.FormalParameters[0]; retVal = cast.createGraphForParameter(context, param); } Function calledFunction = Called.Ref as Function; Dictionary <Parameter, Expression> parameterAssociation = null; if (calledFunction == null) { calledFunction = Called.GetValue(context) as Function; parameterAssociation = createParameterAssociation(calledFunction); } else { parameterAssociation = ParameterAssociation; } Parameter Xaxis = null; foreach (KeyValuePair <Parameter, Expression> pair in parameterAssociation) { if (pair.Value.Ref == parameter) { if (Xaxis == null) { Xaxis = pair.Key; } else { Root.AddError("Cannot evaluate graph for function call " + ToString() + " which has more than 1 parameter used as X axis"); Xaxis = null; break; } } } int token = context.LocalScope.PushContext(); calledFunction.AssignParameters(context, AssignParameterValues(context, calledFunction, false)); if (Xaxis != null) { retVal = calledFunction.createGraphForParameter(context, Xaxis); } else { retVal = Function.createGraphForValue(GetValue(context)); } context.LocalScope.PopContext(token); return(retVal); }
public override INodeAttributes GetAttributes(string[] pathElements, INodeAttributes inode) { Called.AddItem("getAttributes"); bool useDefault = UseDefault(pathElements); return(new _INodeAttributes_80(inode, useDefault)); }
/// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/> public virtual void CheckPermission(string fsOwner, string supergroup, UserGroupInformation ugi, INodeAttributes[] inodeAttrs, INode[] inodes, byte[][] pathByNameArr, int snapshotId, string path, int ancestorIndex, bool doCheckOwner, FsAction ancestorAccess , FsAction parentAccess, FsAction access, FsAction subAccess, bool ignoreEmptyDir ) { Called.AddItem("checkPermission|" + ancestorAccess + "|" + parentAccess + "|" + access ); }
private void tcpClient_DataReceived(EventDrivenTcpClient sender, object data) { Log.Trace("Message received: {0}", data); //Outgoing call: Date;CALL;ConnectionID;LocalExtension;LocalNumber;RemoteNumber; //Incoming call: Date;RING;ConnectionID;RemoteNumber;LocalNumber; //On connection established: Date;CONNECT;ConnectionID;LocalExtension;RemoteNumber; //On connection end: Date;DISCONNECT;ConnectionID;DurtionInSeconds; string[] messageParts = data.ToString().Split(';'); DateTime timestamp = DateTime.Parse(messageParts[0]); string eventType = messageParts[1]; string connectionId = messageParts[2]; switch (eventType) { case "CALL": Called?.Invoke(sender, new CallEventArgs() { TimeStamp = timestamp, ConnectionId = connectionId, LocalExtension = messageParts[3], LocalNumber = messageParts[4], RemoteNumber = messageParts[5], }); break; case "RING": Ringed?.Invoke(sender, new RingEventArgs() { TimeStamp = timestamp, ConnectionId = connectionId, RemoteNumber = messageParts[3], LocalNumber = messageParts[4], }); break; case "CONNECT": Connected?.Invoke(sender, new ConnectEventArgs() { TimeStamp = timestamp, ConnectionId = connectionId, LocalExtension = messageParts[3], RemoteNumber = messageParts[4], }); break; case "DISCONNECT": Disconnected?.Invoke(sender, new DisconnectEventArgs() { TimeStamp = timestamp, ConnectionId = connectionId, DurationSeconds = int.Parse(messageParts[3]), }); break; } }
/// <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); Function function = GetFunction(context, explain); Cast cast = function as Cast; if (cast != null) { // In case of cast, just take the surface of the enclosed expression Expression actual = ActualParameters[0]; retVal = actual.CreateSurface(context, xParam, yParam, explain); } else { if (function == null) { function = Called.GetCalled(context, explain) as Function; } if (function != null) { Parameter xAxis; Parameter yAxis; SelectXandYAxis(xParam, yParam, function, out xAxis, out yAxis); if (xAxis != null || yAxis != null) { int token = context.LocalScope.PushContext(); function.AssignParameters(context, AssignParameterValues(context, function, true, explain)); retVal = function.CreateSurfaceForParameters(context, xAxis, yAxis, explain); context.LocalScope.PopContext(token); } else { IValue value = GetValue(context, explain); if (value != null) { retVal = Surface.createSurface(value, xParam, yParam); } else { throw new Exception("Cannot create surface for expression"); } } } else { AddError("Cannot determine called function", RuleChecksEnum.SemanticAnalysisError); } } retVal.XParameter = xParam; retVal.YParameter = yParam; return(retVal); }
public CallErrorCode Call(string targetPhoneNumber) { var eventArgs = new CallEventArgs(targetPhoneNumber); eventArgs.DateTimeBeginCall = DateTime.Now; Called?.Invoke(this, eventArgs); return(eventArgs.ErrorCode); }
/// <summary> /// Provides the ICallable that is statically defined /// </summary> public override ICallable getStaticCallable() { ICallable retVal = base.getStaticCallable(); if (retVal == null) { retVal = Called.getStaticCallable().ReturnType as ICallable; } return(retVal); }
/// <summary> /// Indicates whether this call may read a given variable /// </summary> /// <param name="variable"></param> /// <returns></returns> public bool Reads(Types.ITypedElement variable) { bool retVal = false; Function function = Called.getStaticCallable() as Function; if (function != null) { retVal = function.Reads(variable); } return(retVal); }
/// <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> /// <returns>The surface which corresponds to this expression</returns> public override Functions.Surface createSurface(Interpreter.InterpretationContext context, Parameter xParam, Parameter yParam) { Functions.Surface retVal = base.createSurface(context, xParam, yParam); Functions.Function function = getFunction(context); Functions.PredefinedFunctions.Cast cast = Called.Ref as Functions.PredefinedFunctions.Cast; if (cast != null) { // In case of cast, just take the surface of the enclosed expression Expression actual = (Expression)ActualParameters[0]; retVal = actual.createSurface(context, xParam, yParam); } else { Parameter Xaxis = null; Parameter Yaxis = null; if (function == null) { function = Called.getCalled(context) as Function; } SelectXandYAxis(context, xParam, yParam, function, out Xaxis, out Yaxis); if (Xaxis != null || Yaxis != null) { int token = context.LocalScope.PushContext(); function.AssignParameters(context, AssignParameterValues(context, function, true)); retVal = function.createSurfaceForParameters(context, Xaxis, Yaxis); context.LocalScope.PopContext(token); } else { Values.IValue value = GetValue(context); if (value != null) { retVal = Functions.Surface.createSurface(value, xParam, yParam); } else { throw new Exception("Cannot create surface for expression"); } } } retVal.XParameter = xParam; retVal.YParameter = yParam; return(retVal); }
/// <summary> /// Provides the type of this expression /// </summary> /// <param name="context">The interpretation context</param> /// <returns></returns> public override Types.Type GetExpressionType() { Types.Type retVal = null; Functions.Function function = Called.getStaticCallable() as Functions.Function; if (function != null) { retVal = function.ReturnType; } else { AddError("Cannot get type of function call " + ToString()); } return(retVal); }
/// <summary> /// Provides the type of this expression /// </summary> /// <returns></returns> public override Type GetExpressionType() { Type retVal = null; Function function = Called.GetStaticCallable() as Function; if (function != null) { retVal = function.ReturnType; } else { AddError("Cannot get type of function call " + ToString(), RuleChecksEnum.SemanticAnalysisError); } return(retVal); }
/// <summary> /// Performs the semantic analysis of the expression /// </summary> /// <param name="instance">the reference instance on which this element should analysed</param> /// <paraparam name="expectation">Indicates the kind of element we are looking for</paraparam> /// <returns>True if semantic analysis should be continued</returns> public override bool SemanticAnalysis(Utils.INamable instance, Filter.AcceptableChoice expectation) { bool retVal = base.SemanticAnalysis(instance, expectation); if (retVal) { Called.SemanticAnalysis(instance, Filter.IsCallable); foreach (Expression actual in AllParameters) { actual.SemanticAnalysis(instance, Filter.IsActualParameter); } ParameterAssociation = createParameterAssociation(Called.Ref as ICallable); } return(retVal); }
/// <summary> /// Performs the semantic analysis of the expression /// </summary> /// <param name="instance">the reference instance on which this element should analysed</param> /// <param name="expectation">Indicates the kind of element we are looking for</param> /// <returns>True if semantic analysis should be continued</returns> public override bool SemanticAnalysis(INamable instance, BaseFilter expectation) { bool retVal = base.SemanticAnalysis(instance, expectation); if (retVal) { // Called if (Called != null) { Called.SemanticAnalysis(instance, IsCallable.INSTANCE); StaticUsage.AddUsages(Called.StaticUsage, Usage.ModeEnum.Call); // Actual parameters foreach (Expression actual in ActualParameters) { actual.SemanticAnalysis(instance, IsActualParameter.INSTANCE); StaticUsage.AddUsages(actual.StaticUsage, Usage.ModeEnum.Read); } foreach (KeyValuePair <Designator, Expression> pair in NamedActualParameters) { ICallable called = Called.Ref as ICallable; if (called != null) { pair.Key.Ref = called.GetFormalParameter(pair.Key.Image); StaticUsage.AddUsage(pair.Key.Ref, Root, Usage.ModeEnum.Parameter); } pair.Value.SemanticAnalysis(instance, IsActualParameter.INSTANCE); StaticUsage.AddUsages(pair.Value.StaticUsage, Usage.ModeEnum.Read); } ParameterAssociation = CreateParameterAssociation(Called.Ref as ICallable); } else { AddError("Called function not provided", RuleChecksEnum.SemanticAnalysisError); } } return(retVal); }
public Task InitializeAsync(AppInfo info) { Called?.Invoke(this, new MockCall(nameof(InitializeAsync), info)); return(Task.CompletedTask); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { return(Type.GetHashCode() + Caller.GetHashCode() + Called.GetHashCode()); }
void HandleMyCommand(MyCommand message) { Called.Complete(message); }
private static void OnCalled(Commands e) { Called?.Invoke(null, e); }
private void ExecuteAll(IntPtr handle) { var list = new List <Entry>(configuration.Items); foreach (var item in list) { if (!IsWorking) { return; } if (!item.IsEnabled) { continue; } if (item.InitialDelay > 0) { Thread.Sleep(item.InitialDelay); } if (!IsWorking) { return; } int winActive = 0; for (int i = 0; i < item.LoopCount; i++) { if (!IsWorking) { return; } winActive = AutoItX.WinActive(handle); if (winActive == 1) { switch (item.CmdType) { case CmdTypes.Key: ExecuteKeys(item); break; case CmdTypes.MouseClick: ExecuteMouse(item); break; default: ExecuteStringList(item); break; } } if (item.LoopInterval > 0 && i < item.LoopCount - 1) { Thread.Sleep(item.LoopInterval); } if (!IsWorking) { return; } } if (winActive == 1) { Called?.Invoke(); } } }
public override void Start() { Called.AddItem("start"); }
public override void Stop() { Called.AddItem("stop"); }
/// <summary> /// Checks the expression and appends errors to the root tree node when inconsistencies are found /// </summary> public override void checkExpression() { base.checkExpression(); Called.checkExpression(); ICallable called = Called.getStaticCallable(); if (called != null) { if (called.FormalParameters.Count != NamedActualParameters.Count + ActualParameters.Count) { AddError("Invalid number of arguments provided for function call " + ToString() + " expected " + called.FormalParameters.Count + " actual " + NamedActualParameters.Count); } else { Dictionary <string, Expression> actuals = new Dictionary <string, Expression>(); int i = 0; foreach (Expression expression in ActualParameters) { Parameter parameter = called.FormalParameters[i] as Parameter; CheckActualAgainstFormal(actuals, expression, parameter); i = i + 1; } foreach (KeyValuePair <string, Expression> pair in NamedActualParameters) { string name = pair.Key; Expression expression = pair.Value; Parameter parameter = called.getFormalParameter(name); if (parameter == null) { AddError("Parameter " + name + " is not defined as formal parameter of function " + called.FullName); } else { if (actuals.ContainsKey(name)) { AddError("Parameter " + name + " isassigned twice in " + ToString()); } else { CheckActualAgainstFormal(actuals, expression, parameter); } } } if (called.FormalParameters.Count > 2) { if (ActualParameters.Count > 0) { AddWarning("Calls where more than two parameters are provided must be performed using named association"); } } called.additionalChecks(Root, actuals); } } else { AddError("Cannot determine callable referenced by " + ToString()); } }
/// <summary> /// Creates the graph associated to this expression, when the given parameter ranges over the X axis /// </summary> /// <param name="context">The interpretation context</param> /// <param name="parameter">The parameters of *the enclosing function* for which the graph should be created</param> /// <param name="explain"></param> /// <returns></returns> public override Graph CreateGraph(InterpretationContext context, Parameter parameter, ExplanationPart explain) { Graph retVal = base.CreateGraph(context, parameter, explain); Cast cast = Called.Ref as Cast; if (cast != null) { // In case of cast, just take the graph of the enclosed expression Parameter param = (Parameter)cast.FormalParameters[0]; retVal = cast.CreateGraphForParameter(context, param, explain); } else { Function calledFunction = Called.Ref as Function; Dictionary <Parameter, Expression> parameterAssociation; if (calledFunction == null) { calledFunction = Called.GetValue(context, explain) as Function; parameterAssociation = CreateParameterAssociation(calledFunction); } else { parameterAssociation = ParameterAssociation; } if (calledFunction != null) { Parameter xAxis = null; foreach (KeyValuePair <Parameter, Expression> pair in parameterAssociation) { if (pair.Value.Ref == parameter) { if (xAxis == null) { xAxis = pair.Key; } else { Root.AddError("Cannot evaluate graph for function call " + ToString() + " which has more than 1 parameter used as X axis"); xAxis = null; break; } } } int token = context.LocalScope.PushContext(); calledFunction.AssignParameters(context, AssignParameterValues(context, calledFunction, false, explain)); if (xAxis != null) { retVal = calledFunction.CreateGraphForParameter(context, xAxis, explain); } else { retVal = Function.CreateGraphForValue(GetValue(context, explain)); } context.LocalScope.PopContext(token); } else { AddError("Cannot determine called function", RuleChecksEnum.SemanticAnalysisError); } } return(retVal); }
private void ImageButton_Click(ImageButton arg1, RoutedEventArgs arg2) { Called?.Invoke(this); }
public Task UninitializeAsync() { Called?.Invoke(this, new MockCall(nameof(UninitializeAsync))); return(Task.CompletedTask); }
public Task <Guid> CreateKeyboardEffectAsync <T>(KeyboardEffect effect, T data) where T : struct { Called?.Invoke(this, new MockCall(nameof(CreateKeyboardEffectAsync), data)); return(Task.FromResult(Guid.NewGuid())); }
public void Raise() { Called?.Invoke(this, new EventArgs()); }