Esempio n. 1
0
        public void TerminateStudy()
        {
            // use STUDY00000024 as template
            string targetStudy = "AutoTest-" + DataGen.String(5);

            CloneEntity("STUDY00000024", targetStudy);

            var ActionsNav     = new ActivitiesNav();
            var TerminatePopup = new Terminate("STUDY-" + targetStudy, "Terminate");
            var Inbox          = new Inbox();

            Store.LoginAsUser(Users.Irbd);
            ActionsNav.LnkSubmissions.Click();
            Inbox.LnkAdvanced.Click();
            Wait.Until(h => Inbox.QueryField1.Displayed);
            Inbox.QueryField1.SelectByInnerText("Name");
            Wait.Until(h => Inbox.QueryCriteria1.Enabled);
            Inbox.QueryCriteria1.Text = targetStudy;
            Wait.Until(d => Inbox.BtnGo.Enabled);
            Inbox.BtnGo.Click();
            Wait.Until(d => Inbox.BtnGo.Enabled);

            var studyForReview = new CCElement(By.LinkText(targetStudy));

            studyForReview.Click();
            ActionsNav.LnkTerminate.Click();
            TerminatePopup.SwitchTo();
            TerminatePopup.TxtComments.Value = "Terminating this study for automation!";
            TerminatePopup.BtnOk.Click();
            TerminatePopup.SwitchBackToParent();

            Wait.Until(h => new CCElement(By.LinkText("Terminated")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Terminated")).Exists, "'Terminated' activity not found for:  " + targetStudy);
        }
Esempio n. 2
0
        public async Task StopAsync( )
        {
            if (!IsRunning)
            {
                return;
            }
            IsRunning = false;

            Logger.Info("Stopping Bot");

            FiatConverter.StopMonitor( );
            if (!Cts.IsCancellationRequested)
            {
                Cts.Cancel( );
            }

            var services = Services.ToList( );

            foreach (var service in services)
            {
                await DetachAsync(service).ConfigureAwait(false);
            }

            Terminate?.Invoke(this);
        }
Esempio n. 3
0
        public static void Init()
        {
            var path = GetDLLPath();

            if (path == null)
            {
                throw new Exception("EZTransXP를 찾을 수 없습니다");
            }

            EZTransXPHandle = LoadLibrary(Path.Combine(path, "J2KEngine.dll"));
            if (EZTransXPHandle == IntPtr.Zero)
            {
                throw new Exception("J2KEngine.dll 을 로드할 수 없습니다. 경로가 잘못되었거나 EZTransXP가 잘못되었습니다.");
            }

            J2K_InitializeEx  = Marshal.GetDelegateForFunctionPointer <InitializeEx>(GetProcAddressWithCheck(EZTransXPHandle, "J2K_InitializeEx"));
            J2K_Terminate     = Marshal.GetDelegateForFunctionPointer <Terminate>(GetProcAddressWithCheck(EZTransXPHandle, "J2K_Terminate"));
            J2K_FreeMem       = Marshal.GetDelegateForFunctionPointer <FreeMem>(GetProcAddressWithCheck(EZTransXPHandle, "J2K_FreeMem"));
            J2K_TranslateMMNT = Marshal.GetDelegateForFunctionPointer <TranslateMMNT>(GetProcAddressWithCheck(EZTransXPHandle, "J2K_TranslateMMNT"));
            try
            {
                J2K_TranslateMMNTW = Marshal.GetDelegateForFunctionPointer <TranslateMMNTW>(GetProcAddressWithCheck(EZTransXPHandle, "J2K_TranslateMMNTW"));
            }catch (Exception e)
            {
            }

            //From Anemo
            J2K_InitializeEx("CSUSER123455", Path.Combine(path, "Dat"));

            IsInited = true;
        }
Esempio n. 4
0
        private static Log PSO(int numberOfAntenae, double steeringAngle, Terminate t)
        {
            AntennaArray antenna = new AntennaArray(numberOfAntenae, steeringAngle);
            Swarm        swarm   = new Swarm(numberOfAntenae - 1, antenna, t, (uint)(20 + Math.Sqrt(numberOfAntenae)));

            return(swarm.StartPSO());
        }
        public void Terminate_Get_Set()
        {
            var terminate = new Terminate {
                Restart = true
            };

            Assert.True(terminate.Restart);
        }
        public async Task <IActionResult> Terminate(Guid id, Terminate request)
        {
            request.EmployeeId = id;

            await mediator.Send(request);

            return(Ok());
        }
Esempio n. 7
0
        public ActionResult DeleteConfirmed(string id)
        {
            Terminate terminate = db.Terminates.Find(id);

            db.Terminates.Remove(terminate);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "UpId,BadgeId,DateJobTermination,BadgeTerminationDate,BadgeReturned")] Terminate terminate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(terminate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BadgeId = new SelectList(db.Badges, "BadgeId", "BadgeId");
     return(View(terminate));
 }
Esempio n. 9
0
        public ActionResult Create([Bind(Include = "UpId,DateJobTermination,BadgeTerminationDate,BadgeReturned")] Terminate terminate)
        {
            if (ModelState.IsValid)
            {
                db.Terminates.Add(terminate);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BadgeId = new SelectList(db.Badges, "BadgeId", "BadgeId");
            return(View(terminate));
        }
Esempio n. 10
0
        // GET: Terminate/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Terminate terminate = db.Terminates.Find(id);

            if (terminate == null)
            {
                return(HttpNotFound());
            }
            return(View(terminate));
        }
Esempio n. 11
0
 public static TResult Convert <TResult>(
     this IInstruction instruction,
     Func <Noop, TResult> noopCase,
     Func <Accumulate, TResult> accumulateCase,
     Func <Jump, TResult> jumpCase,
     Func <Terminate, TResult> terminateCase)
 {
     return(instruction switch
     {
         Noop n => noopCase(n),
         Accumulate a => accumulateCase(a),
         Jump j => jumpCase(j),
         Terminate t => terminateCase(t),
         _ => throw new ArgumentOutOfRangeException(),
     });
Esempio n. 12
0
        public Swarm(int dimensions, AntennaArray antenna, Terminate terminalCondition, uint numberOfParticles)
        {
            particles      = new LinkedList <Particle>();
            this.terminate = terminalCondition;
            this.antenna   = antenna;


            for (int i = 0; i < numberOfParticles; i++)
            {
                particles.AddLast(new Particle(
                                      dimentions: dimensions,
                                      costFunction: antenna.Evaluate,
                                      initalise: new RandomInitalise()
                                      ));
            }
        }
Esempio n. 13
0
        // GET: Terminate/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Terminate terminate = db.Terminates.Find(id);

            if (terminate == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BadgeId = new SelectList(db.Badges, "BadgeId", "BadgeId");

            return(View(terminate));
        }
Esempio n. 14
0
        public TheModel()
        {
            this.Server = 10000;
            base.AddName("Server", this.Server);
            Storage storage = new Storage(new NumberOperand(1));

            storage.SetId(this.Server);
            base.AddVerb(storage);

            Start start = new Start(new NumberOperand(10000), null, null, null);

            base.AddVerb(start);

            Generate generate = new Generate(new NumberOperand(7), new NumberOperand(5), null, null, null);

            base.AddVerb(generate);

            this.Turn = 10001;
            base.AddName("Turn", this.Turn);
            TheModel theModel = this;
            Queue    queue    = new Queue(new ParExpression(new ExpressionDelegate(theModel.Verb4_Operand1)), null);

            base.AddVerb(queue);

            TheModel theModel1 = this;
            Enter    enter     = new Enter(new ParExpression(new ExpressionDelegate(theModel1.Verb5_Operand1)), null);

            base.AddVerb(enter);

            TheModel theModel2 = this;
            Depart   depart    = new Depart(new ParExpression(new ExpressionDelegate(theModel2.Verb6_Operand1)), null);

            base.AddVerb(depart);

            Advance advance = new Advance(new NumberOperand(5), new NumberOperand(3));

            base.AddVerb(advance);

            TheModel theModel3 = this;
            Leave    leave     = new Leave(new ParExpression(new ExpressionDelegate(theModel3.Verb8_Operand1)), null);

            base.AddVerb(leave);

            Terminate terminate = new Terminate(new NumberOperand(1));

            base.AddVerb(terminate);
        }
    /// <summary>
    /// Executes the 'execute()' method on a new thread, manages it's
    /// life-cycle coherently with the logic of this ExecutableThread
    /// class.
    /// </summary>
    public void run()
    {
        thread = new Thread(() => {
            //lock (synch_obj) {
            //    alive = true;
            //}

            execute();              // execute the logic of the thread
            Terminate?.Invoke();    // execute the operation associated to the end of this thread

            //lock (synch_obj) {
            //    alive = false;          // thread no more alive
            //}
        });
        thread.IsBackground = true;
        thread.Start();
    }
Esempio n. 16
0
        public AngleBackend(bool isCpuBackend = false)
        {
            IsCpuBackend = isCpuBackend;
            var ptrsize = Marshal.SizeOf(typeof(IntPtr));

            if (ptrsize == 8)
            {
                EGL = LoadLibrary("x64/libEGL.dll");
                GL  = LoadLibrary("x64/libGLESv2.dll");
            }
            else
            {
                EGL = LoadLibrary("x86/libEGL.dll");
                GL  = LoadLibrary("x86/libGLESv2.dll");
            }
            EglChooseConfig          = (ChooseConfig)EGL_GetProcAddress("eglChooseConfig", typeof(ChooseConfig));
            EglGetPlatformDisplayExt = (GetPlatformDisplayExt)EGL_GetProcAddress("eglGetPlatformDisplayEXT", typeof(GetPlatformDisplayExt));
            EglInitialize            = (Initialize)EGL_GetProcAddress("eglInitialize", typeof(Initialize));
            EglGetConfigs            = (GetConfigs)EGL_GetProcAddress("eglGetConfigs", typeof(GetConfigs));
            EglCreateContext         = (CreateContext)EGL_GetProcAddress("eglCreateContext", typeof(CreateContext));
            EglCreatePbufferSurface  = (CreatePbufferSurface)EGL_GetProcAddress("eglCreatePbufferSurface", typeof(CreatePbufferSurface));
            EglCreateWindowSurface   = (CreateWindowSurface)EGL_GetProcAddress("eglCreateWindowSurface", typeof(CreateWindowSurface));
            EglDestroyContext        = (DestroyContext)EGL_GetProcAddress("eglDestroyContext", typeof(DestroyContext));
            EglMakeCurrent           = (MakeCurrent)EGL_GetProcAddress("eglMakeCurrent", typeof(MakeCurrent));
            EglSwapBuffers           = (SwapBuffers)EGL_GetProcAddress("eglSwapBuffers", typeof(SwapBuffers));
            EglSurfaceAttrib         = (SurfaceAttrib)EGL_GetProcAddress("eglSurfaceAttrib", typeof(SurfaceAttrib));
            EglWaitClient            = (WaitClient)EGL_GetProcAddress("eglWaitClient", typeof(WaitClient));
            EglWaitGL                             = (WaitGL)EGL_GetProcAddress("eglWaitGL", typeof(WaitGL));
            EglDestroySurface                     = (DestroySurface)EGL_GetProcAddress("eglDestroySurface", typeof(DestroySurface));
            EglSwapInterval                       = (SwapInterval)EGL_GetProcAddress("eglSwapInterval", typeof(SwapInterval));
            EglTerminate                          = (Terminate)EGL_GetProcAddress("eglTerminate", typeof(Terminate));
            EglSurfaceAttrib                      = (SurfaceAttrib)EGL_GetProcAddress("eglSurfaceAttrib", typeof(SurfaceAttrib));
            EglWaitNative                         = (WaitNative)EGL_GetProcAddress("eglWaitNative", typeof(WaitNative));
            EglGetProcAddress                     = (EGLGetProcAddress)EGL_GetProcAddress("eglGetProcAddress", typeof(EGLGetProcAddress));
            GlGetIntegerv                         = (GetIntegerv)GL_GetProcAddress("glGetIntegerv", typeof(GetIntegerv));
            GlBindRenderbuffer                    = (BindRenderbuffer)GL_GetProcAddress("glBindRenderbuffer", typeof(BindRenderbuffer));
            GlFramebufferRenderbuffer             = (FramebufferRenderbuffer)GL_GetProcAddress("glFramebufferRenderbuffer", typeof(FramebufferRenderbuffer));
            GlBindFramebuffer                     = (BindFramebuffer)GL_GetProcAddress("glBindFramebuffer", typeof(BindFramebuffer));
            GlGenRenderbuffers                    = (GenRenderbuffers)GL_GetProcAddress("glGenRenderbuffers", typeof(GenRenderbuffers));
            GlGenFramebuffers                     = (GenFramebuffers)GL_GetProcAddress("glGenFramebuffers", typeof(GenFramebuffers));
            GlRenderbufferStorageMultisampleANGLE =
                (RenderbufferStorageMultisampleANGLE)GL_GetProcAddress("glRenderbufferStorageMultisampleANGLE", typeof(RenderbufferStorageMultisampleANGLE));
            GlBlitFramebufferANGLE =
                (BlitFramebufferANGLE)GL_GetProcAddress("glBlitFramebufferANGLE", typeof(BlitFramebufferANGLE));
        }
Esempio n. 17
0
        /// <summary>
        /// 通过区间内给定的逻辑图终点来生成PLC指令
        /// 要求所有终点的表达式已经生成并排序
        /// </summary>
        /// <param name="terminates">终点列表</param>
        /// <returns>最终的PLC指令列表</returns>
        /// <detail>
        /// 这里需要讲包含关系的表达式集合并到一起
        /// 用特殊的数据结构来表示
        /// </detail>
        static public List <PLCInstruction> GenInst(List <LGVertex> _terminates)
        {
            List <Terminate> terminates = new List <Terminate>();   // 将要处理包含关系,最后的结构放在这里
            Terminate        term       = new Terminate();          // 前后包含关系放在一个单元内
            TPoint           tpoint     = new TPoint();             // 这里构造第一个点

            tpoint.enable    = true;
            tpoint.PLCUnit   = _terminates[0].BackEdges[0].PLCInfo;
            tpoint.ExprIndex = _terminates[0].Expr.Length - 1;
            term.TPoints.Add(tpoint);
            for (int i = 1; i < _terminates.Count; i++)
            {
                LGVertex lgv1 = _terminates[i - 1];
                LGVertex lgv2 = _terminates[i];
                tpoint           = new TPoint();
                tpoint.enable    = true;
                tpoint.PLCUnit   = lgv2.BackEdges[0].PLCInfo;
                tpoint.ExprIndex = lgv2.Expr.Length - 1;
                // 每次对相邻的两个表达式,后面的表达式截为相同长度后进行比较,若相等可归为一类
                if (lgv1.Expr.Length <= lgv2.Expr.Length && lgv1.Expr.Equals(lgv2.Expr.Substring(0, lgv1.Expr.Length)))
                {
                    term.TPoints.Add(tpoint);
                }
                else
                // 不为包含关系,上一个单元结束,设置最终表达式并添加到列表结构中
                {
                    term.Expr = lgv1.Expr;
                    terminates.Add(term);
                    term         = new Terminate();
                    term.TPoints = new List <TPoint>();
                    term.TPoints.Add(tpoint);
                }
            }
            // 最后一个单元添加到表里
            term.Expr = _terminates.Last <LGVertex>().Expr;
            terminates.Add(term);
            // 调用内部方法
            List <PLCInstruction> insts = new List <PLCInstruction>();

            _GenInst(insts, terminates, 0, terminates.Count - 1);
            return(insts);
        }
Esempio n. 18
0
        public TheModel()
        {
            this.Server = 10000;
            base.AddName("Server", this.Server);
            TheModel theModel = this;
            Storage  storage  = new Storage(new ParExpression(new ExpressionDelegate(theModel.Verb1_Operand1)));

            storage.SetId(this.Server);
            base.AddVerb(storage);
            TheModel theModel1 = this;
            Start    start     = new Start(new ParExpression(new ExpressionDelegate(theModel1.Verb2_Operand1)), null, null, null);

            base.AddVerb(start);
            TheModel theModel2 = this;
            Generate generate  = new Generate(new ParExpression(new ExpressionDelegate(theModel2.Verb3_Operand1)), null, null, null, null);

            base.AddVerb(generate);
            this.GenerateCounter = 10001;
            base.AddName("GenerateCounter", this.GenerateCounter);
            TheModel  theModel3 = this;
            TheModel  theModel4 = this;
            Savevalue savevalue = new Savevalue(new ParExpression(new ExpressionDelegate(theModel3.Verb4_Operand1)), new ParExpression(new ExpressionDelegate(theModel4.Verb4_Operand2)));

            base.AddVerb(savevalue);
            this.Tail = 10002;
            base.AddName("Tail", this.Tail);
            this.GoAway = 10003;
            base.AddName("GoAway", this.GoAway);
            LiteralOperand literalOperand = new LiteralOperand("L");
            TheModel       theModel5      = this;
            ParExpression  parExpression  = new ParExpression(new ExpressionDelegate(theModel5.Verb5_Operand2));
            TheModel       theModel6      = this;
            TheModel       theModel7      = this;
            Test           test           = new Test(literalOperand, parExpression, new ParExpression(new ExpressionDelegate(theModel6.Verb5_Operand3)), new ParExpression(new ExpressionDelegate(theModel7.Verb5_Operand4)));

            base.AddVerb(test);
            TheModel theModel8 = this;
            Queue    queue     = new Queue(new ParExpression(new ExpressionDelegate(theModel8.Verb6_Operand1)), null);

            base.AddVerb(queue);
            TheModel theModel9  = this;
            TheModel theModel10 = this;
            Enter    enter      = new Enter(new ParExpression(new ExpressionDelegate(theModel9.Verb7_Operand1)), new ParExpression(new ExpressionDelegate(theModel10.Verb7_Operand2)));

            base.AddVerb(enter);
            TheModel theModel11 = this;
            Depart   depart     = new Depart(new ParExpression(new ExpressionDelegate(theModel11.Verb8_Operand1)), null);

            base.AddVerb(depart);
            TheModel theModel12 = this;
            Advance  advance    = new Advance(new ParExpression(new ExpressionDelegate(theModel12.Verb9_Operand1)), null);

            base.AddVerb(advance);
            TheModel theModel13 = this;
            TheModel theModel14 = this;
            Leave    leave      = new Leave(new ParExpression(new ExpressionDelegate(theModel13.Verb10_Operand1)), new ParExpression(new ExpressionDelegate(theModel14.Verb10_Operand2)));

            base.AddVerb(leave);
            this.RejetionProb = 10004;
            base.AddName("RejetionProb", this.RejetionProb);
            this.RejectCounter = 10005;
            base.AddName("RejectCounter", this.RejectCounter);
            TheModel  theModel15 = this;
            TheModel  theModel16 = this;
            Savevalue savevalue1 = new Savevalue(new ParExpression(new ExpressionDelegate(theModel15.Verb11_Operand1)), new ParExpression(new ExpressionDelegate(theModel16.Verb11_Operand2)));

            base.AddVerb(savevalue1);
            TheModel  theModel17 = this;
            Terminate terminate  = new Terminate(new ParExpression(new ExpressionDelegate(theModel17.Verb12_Operand1)));

            base.AddVerb(terminate);
            this.GoAway = 11;
            base.ReplaceNameId("GoAway", this.GoAway);
            TheModel  theModel18 = this;
            TheModel  theModel19 = this;
            Savevalue savevalue2 = new Savevalue(new ParExpression(new ExpressionDelegate(theModel18.Verb13_Operand1)), new ParExpression(new ExpressionDelegate(theModel19.Verb13_Operand2)));

            base.AddVerb(savevalue2);
            base.AddVerb(new Terminate(null));
        }
Esempio n. 19
0
 /// <summary>
 /// Terminate。
 /// </summary>
 /// <param name="args">事件参数。。</param>
 protected void OnTerminate(TaskTerminateEventArgs args)
 {
     Terminate?.Invoke(this, args);
 }
Esempio n. 20
0
 public TerminateWord(string wordBase, Terminate sType) : base(wordBase, WordType.Terminate)
 {
     WordBase     = wordBase;
     SentencePart = sType;
 }
        public void Can_serialize_Terminate()
        {
            var terminate = new Terminate();

            AssertAndReturn(terminate).Should().BeOfType <Terminate>();
        }
Esempio n. 22
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.seq)
            {
                hashcode = (hashcode * 397) + Seq.GetHashCode();
            }
            if (__isset.type)
            {
                hashcode = (hashcode * 397) + Type.GetHashCode();
            }
            if (__isset.dialedNumber)
            {
                hashcode = (hashcode * 397) + DialedNumber.GetHashCode();
            }
            if (__isset.calledNumber)
            {
                hashcode = (hashcode * 397) + CalledNumber.GetHashCode();
            }
            if (__isset.toMid)
            {
                hashcode = (hashcode * 397) + ToMid.GetHashCode();
            }
            if (__isset.toName)
            {
                hashcode = (hashcode * 397) + ToName.GetHashCode();
            }
            if (__isset.setupTime)
            {
                hashcode = (hashcode * 397) + SetupTime.GetHashCode();
            }
            if (__isset.startTime)
            {
                hashcode = (hashcode * 397) + StartTime.GetHashCode();
            }
            if (__isset.endTime)
            {
                hashcode = (hashcode * 397) + EndTime.GetHashCode();
            }
            if (__isset.duration)
            {
                hashcode = (hashcode * 397) + Duration.GetHashCode();
            }
            if (__isset.terminate)
            {
                hashcode = (hashcode * 397) + Terminate.GetHashCode();
            }
            if (__isset.productType)
            {
                hashcode = (hashcode * 397) + ProductType.GetHashCode();
            }
            if (__isset.charge)
            {
                hashcode = (hashcode * 397) + Charge.GetHashCode();
            }
            if (__isset.unit)
            {
                hashcode = (hashcode * 397) + Unit.GetHashCode();
            }
            if (__isset.result)
            {
                hashcode = (hashcode * 397) + Result.GetHashCode();
            }
        }
        return(hashcode);
    }
Esempio n. 23
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("PaidCallHistory(");
        bool __first = true;

        if (__isset.seq)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Seq: ");
            Seq.ToString(sb);
        }
        if (__isset.type)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Type: ");
            Type.ToString(sb);
        }
        if (DialedNumber != null && __isset.dialedNumber)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("DialedNumber: ");
            DialedNumber.ToString(sb);
        }
        if (CalledNumber != null && __isset.calledNumber)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CalledNumber: ");
            CalledNumber.ToString(sb);
        }
        if (ToMid != null && __isset.toMid)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ToMid: ");
            ToMid.ToString(sb);
        }
        if (ToName != null && __isset.toName)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ToName: ");
            ToName.ToString(sb);
        }
        if (__isset.setupTime)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SetupTime: ");
            SetupTime.ToString(sb);
        }
        if (__isset.startTime)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("StartTime: ");
            StartTime.ToString(sb);
        }
        if (__isset.endTime)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("EndTime: ");
            EndTime.ToString(sb);
        }
        if (__isset.duration)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Duration: ");
            Duration.ToString(sb);
        }
        if (__isset.terminate)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Terminate: ");
            Terminate.ToString(sb);
        }
        if (__isset.productType)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ProductType: ");
            ProductType.ToString(sb);
        }
        if (__isset.charge)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Charge: ");
            Charge.ToString(sb);
        }
        if (Unit != null && __isset.unit)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Unit: ");
            Unit.ToString(sb);
        }
        if (Result != null && __isset.result)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Result: ");
            Result.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
Esempio n. 24
0
        DebugCmd ParseCmd(string line)
        {
            string[] args = System.Text.RegularExpressions.Regex.Split(line, @"\s+");
            if (args.Length == 0)
            {
                return(null);
            }
            if (args[0] == "b" && args.Length == 3)
            {
                BreakCmd   cmd   = new BreakCmd();
                BreakPoint point = new BreakPoint();
                point.file_name = args[1];
                point.line      = Convert.ToInt32(args[2]);
                cmd.m_cmd_mode  = BreakCmd.BreakCmdMode.Set;
                cmd.m_break_points.Add(point);
                return(cmd);
            }
            else if (args[0] == "br" && args.Length >= 2)
            {
                BreakCmd cmd = new BreakCmd();
                if (args[1] == "list")
                {
                    cmd.m_cmd_mode = BreakCmd.BreakCmdMode.List;
                    return(cmd);
                }
                else if (args[1] == "clear")
                {
                    cmd.m_cmd_mode = BreakCmd.BreakCmdMode.DeleteAll;
                    return(cmd);
                }
                else if (args[1] == "delete" && args.Length >= 3)
                {
                    cmd.m_cmd_mode = BreakCmd.BreakCmdMode.Delete;
                    for (int i = 2; i < args.Length; ++i)
                    {
                        BreakPoint point = new BreakPoint();
                        point.index = Convert.ToInt32(args[i]);
                        cmd.m_break_points.Add(point);
                    }
                    return(cmd);
                }
            }
            else if (args[0] == "c")
            {
                Continue cmd = new Continue();
                return(cmd);
            }
            else if (args[0] == "n")
            {
                StepOver cmd = new StepOver();
                return(cmd);
            }
            else if (args[0] == "s")
            {
                StepIn cmd = new StepIn();
                return(cmd);
            }
            else if (args[0] == "f")
            {
                StepOut cmd = new StepOut();
                return(cmd);
            }
            else if (args[0] == "bt")
            {
                BackTraceCmd cmd = new BackTraceCmd();
                return(cmd);
            }
            else if (args[0] == "p" && args.Length == 2)
            {
                PrintCmd cmd = new PrintCmd();
                cmd.m_name = args[1];
                return(cmd);
            }
            else if (args[0] == "t")
            {
                Terminate cmd = new Terminate();
                return(cmd);
            }
            else if (args[0] == "h")
            {
                Console.Write(_help_info);
            }
            else
            {
                Console.WriteLine("what do you want? type 'h' for help");
            }

            return(null);
        }
Esempio n. 25
0
 public TerminateCommand(Terminate terminate)
     : base(terminate.StartTime, 0)
 {
 }
Esempio n. 26
0
        public MM3Model_Dynamic()
        {
            // Server STORAGE 3
            this.SERVER = 10000;
            this.AddName("SERVER", SERVER);
            AnyCommand command1 = new Storage(new ParExpression(this.Command1_Operand1));

            command1.SetId(this.SERVER);
            this.AddVerb(command1);

            // START 1000
            AnyCommand command2 = new Start(new ParExpression(this.Command2_Operand1), null, null, null);

            this.AddVerb(command2);

            // GENERATE (Exponential(1,0,1/2))
            AnyBlock block1 = new Generate(new ParExpression(this.Block1_Operand1), null, null, null, null);

            this.AddVerb(block1);

            // SAVEVALUE GenerateCounter,X$GenerateCounter+1
            this.GENERATECOUNTER = 10001;
            this.AddName("GENERATECOUNTER", GENERATECOUNTER);
            AnyBlock block2 = new Savevalue(new ParExpression(this.Block2_Operand1), new ParExpression(this.Block2_Operand2));

            this.AddVerb(block2);

            // TEST L Q$Tail,20,GoAway		;Jump if in Queue >20
            this.TAIL = 10002;
            this.AddName("TAIL", TAIL);
            this.GOAWAY = 10003;
            this.AddName("GOAWAY", GOAWAY);
            AnyBlock block3 = new Test(new LiteralOperand("L"), new ParExpression(this.Block3_Operand2), new ParExpression(this.Block3_Operand3), new ParExpression(this.Block3_Operand4));

            this.AddVerb(block3);

            // QUEUE Tail
            AnyBlock block4 = new Queue(new ParExpression(this.Block4_Operand1), null);

            this.AddVerb(block4);

            // ENTER Server,1
            AnyBlock block5 = new Enter(new ParExpression(this.Block5_Operand1), new ParExpression(this.Block5_Operand2));

            this.AddVerb(block5);

            // DEPART Tail
            AnyBlock block6 = new Depart(new ParExpression(this.Block6_Operand1), null);

            this.AddVerb(block6);

            // ADVANCE (Exponential(2,0,1/0.2))
            AnyBlock block7 = new Advance(new ParExpression(this.Block7_Operand1), null);

            this.AddVerb(block7);

            // LEAVE Server,1
            AnyBlock block8 = new Leave(new ParExpression(this.Block8_Operand1), new ParExpression(this.Block8_Operand2));

            this.AddVerb(block8);

            // SAVEVALUE RejetionProb,(X$RejectCounter/X$GenerateCounter)
            this.REJETIONPROB = 10004;
            this.AddName("REJETIONPROB", REJETIONPROB);
            this.REJECTCOUNTER = 10005;
            this.AddName("REJECTCOUNTER", REJECTCOUNTER);
            AnyBlock block9 = new Savevalue(new ParExpression(this.Block9_Operand1), new ParExpression(this.Block9_Operand2));

            this.AddVerb(block9);

            // TERMINATE 1
            AnyBlock block10 = new Terminate(new ParExpression(this.Block10_Operand1));

            this.AddVerb(block10);

            // GoAway	SAVEVALUE RejectCounter,X$RejectCounter+1
            this.GOAWAY = 11;
            this.ReplaceNameId("GOAWAY", GOAWAY);
            AnyBlock block11 = new Savevalue(new ParExpression(this.Block11_Operand1), new ParExpression(this.Block11_Operand2));

            this.AddVerb(block11);

            // TERMINATE        ;Delete rejected.
            AnyBlock block12 = new Terminate(null);

            this.AddVerb(block12);
        }
Esempio n. 27
0
        /// <summary>
        /// 通过区间内给定的逻辑图终点来生成PLC指令
        /// </summary>
        /// <param name="terminates">终点列表</param>
        /// <param name="left">区间头</param>
        /// <param name="right">区间尾</param>
        /// <param name="padding">访问过的最大前缀</param>
        /// <param name="flag">标记</param>
        /// <detail>
        /// 这↑里↓和表达式合并的想法一样,所以也需要将表达式排序
        /// 不同的是,这里要解决的是辅助栈的分配问题,所以需要找到所有分歧点
        /// 然后根据数量来确定辅助栈的操作
        /// </detail>
        static private void _GenInst(List <PLCInstruction> insts, List <Terminate> terminates, int left, int right, int padding = 0, int flag = 0)
        {
            int i, j;

            // 只有一个终点时,需要对这个终点单元进行解析
            // 一般来讲,这个单元的表达式被里面的坐标集合分为多段
            // 需要对每一段分别进行计算和执行终点指令
            if (left == right)
            {
                Terminate term = terminates[left];
                // 生成第一段
                _GenInst(insts, term.Expr, padding, term.TPoints[0].ExprIndex, flag);
                if (term.TPoints[0].enable)
                {
                    term.TPoints[0].PLCUnit.GenInst(insts, flag);
                }
                for (i = 1; i < term.TPoints.Count; i++)
                {
                    // 依次生成每一段
                    if (term.TPoints[i - 1].ExprIndex + 2 < term.TPoints[i].ExprIndex)
                    {
                        _GenInst(insts, term.Expr, term.TPoints[i - 1].ExprIndex + 3, term.TPoints[i].ExprIndex, flag | FLAG_CALAND);
                    }
                    if (term.TPoints[i].enable)
                    {
                        term.TPoints[i].PLCUnit.GenInst(insts, flag);
                    }
                }
            }
            else
            {
                // 扩展公共前缀
                bool allequal = true;                      // 判断所有表达式在当前位是否相等
                //bool allinside = true;               // 判断当前位是否至少被一个表达式包含
                List <int> difpoints   = new List <int>(); // 分歧点队列
                int        old_padding = padding;
                int        andpos      = padding;          // 这里需要记录最后的与运算符的位置

                /*
                 * 开始查找下一个分歧点
                 * 注意当前检查的位置超过其中一个表达式的长度时,两个表达式比较时视为相等
                 */
                while (allequal)
                {
                    for (i = left + 1; i <= right; i++)
                    {
                        string expr1 = terminates[i - 1].Expr;
                        string expr2 = terminates[i].Expr;
                        if (expr1[padding] != expr2[padding])
                        {
                            allequal = false;
                            break;
                        }
                    }
                    if (allequal == true)
                    {
                        padding++;
                    }
                }
                // 向前修正前缀末尾为and计算符
                while (padding > old_padding && terminates[left].Expr[padding] != '&')
                {
                    padding--;
                }
                // 然后向后查找所有的分歧点
                for (i = left + 1; i <= right; i++)
                {
                    string expr1 = terminates[i - 1].Expr;
                    string expr2 = terminates[i].Expr;

                    /*
                     * 两个表达式都到达末尾的情况下
                     * 由于表达式的末尾都是原型不同的常量1,所以无需比较默认相同
                     */
                    bool isend1 = !expr1.Substring(padding + 1).Contains('&');
                    bool isend2 = !expr2.Substring(padding + 1).Contains('&');
                    if (isend1 && isend2)
                    {
                        continue;
                    }
                    // 向后查找直到到达and运算符为止
                    for (j = padding + 1; j < expr1.Length && j < expr2.Length; j++)
                    {
                        if (!expr1[j].Equals(expr2[j]))
                        {
                            break;
                        }
                        if (expr1[j] == '&')
                        {
                            break;
                        }
                    }

                    /* 若不相同则为分歧点
                     * 当下标超过某个表达式的长度时,不视为分歧点
                     */
                    if (j < expr1.Length && j < expr2.Length && !expr1[j].Equals(expr2[j]))
                    {
                        difpoints.Add(i);
                    }
                }
                // CASE 1 : 若未找到新的公共前缀
                if (old_padding >= padding)
                {
                    // 如果不存在分歧点,直接输出所有结果指令
                    if (difpoints.Count() == 0)
                    {
                        for (i = left; i <= right; i++)
                        {
                            _GenInst(insts, terminates, i, i, padding, flag);
                        }
                    }
                    else
                    {
                        // 根据分歧点将所有终点进行划分,然后分别处理
                        _GenInst(insts, terminates, left, difpoints[0] - 1, padding, flag);
                        for (i = 1; i < difpoints.Count; i++)
                        {
                            _GenInst(insts, terminates, difpoints[i - 1], difpoints[i] - 1, padding, flag);
                        }
                        _GenInst(insts, terminates, difpoints[i - 1], right, padding, flag);
                    }
                    // 分割成子块来处理,所以不需要POP
                    return;
                }
                // CASE 2 : 找到新的公共前缀时,需要将前缀内的结果用辅助栈存起来
                // 根据分歧点将所有终点进行划分,然后分别处理
                // 并根据分歧点的数量来决定辅助栈的操作
                else
                {
                    //_GenInst(insts, terminates[left].Expr, old_padding, padding - 2, flag);

                    /*
                     * 如果更新的这一段前缀中包含其中一些终点的坐标
                     * 如果不考虑这些坐标,相应的终点就会被忽略
                     * 需要分以下步骤来解决这个问题
                     *      1. 将所有坐标升序排序
                     *      2. 将这段前缀按照坐标进行分段,然后每一段算出结果后执行终点指令
                     */
                    // 查询所有符合条件的tpoint
                    List <TPoint> tpoints = new List <TPoint>();
                    for (i = left; i <= right; i++)
                    {
                        foreach (TPoint tp in terminates[i].TPoints)
                        {
                            if (tp.ExprIndex >= old_padding && tp.ExprIndex <= padding - 2)
                            {
                                tpoints.Add(tp);
                            }
                        }
                    }
                    // 如果存在
                    if (tpoints.Count > 0)
                    {
                        // 所有找到的坐标进行排序
                        tpoints.Sort();
                        // 计算第一个坐标前面的值,并运行对应的第一个终点指令
                        _GenInst(insts, terminates[left].Expr, old_padding, tpoints[0].ExprIndex, flag);
                        tpoints[0].PLCUnit.GenInst(insts, flag);
                        tpoints[0].enable = false;
                        for (i = 1; i < tpoints.Count; i++)
                        {
                            // 依次计算坐标间隔的表达式的值,并执行终点指令
                            _GenInst(insts, terminates[left].Expr, tpoints[i - 1].ExprIndex + 3, tpoints[i].ExprIndex, flag | FLAG_CALAND);
                            tpoints[i].PLCUnit.GenInst(insts, flag);
                            tpoints[i].enable = false;
                        }
                        // 计算最后一个坐标后到找到的前缀之间的表达式的值
                        _GenInst(insts, terminates[left].Expr, tpoints[i - 1].ExprIndex + 3, padding - 2, flag | FLAG_CALAND);
                    }
                    // 如果没有
                    else
                    {
                        // 直接计算当前前缀的表达式
                        _GenInst(insts, terminates[left].Expr, old_padding, padding - 2, flag);
                    }
                    // 如果不存在分歧点,直接输出所有结果指令
                    if (difpoints.Count() == 0)
                    {
                        for (i = left; i <= right; i++)
                        {
                            _GenInst(insts, terminates, i, i, padding + 1, flag | FLAG_CALAND);
                        }
                    }
                    // 以下为涉及到辅助栈的PLC代码生成
                    else
                    {
                        // 将计算结果暂存进辅助栈
                        InstHelper.AddInst(insts, "MPS");
                        // 生成第一组终点的PLC指令程序
                        _GenInst(insts, terminates, left, difpoints[0] - 1, padding + 1, flag | FLAG_CALAND);
                        for (i = 1; i < difpoints.Count; i++)
                        {
                            // 中间结果从辅助栈中取出来,恢复现场
                            InstHelper.AddInst(insts, "MRD");
                            // 依次生成下一组
                            _GenInst(insts, terminates, difpoints[i - 1], difpoints[i] - 1, padding + 1, flag | FLAG_CALAND);
                        }
                        // 最后一次用到辅助栈,所以直接弹出
                        InstHelper.AddInst(insts, "MPP");
                        // 生成最后一组
                        _GenInst(insts, terminates, difpoints[i - 1], right, padding + 1, flag | FLAG_CALAND);
                    }
                }
            }

            /*
             * 前面没有与运算和或运算的链接,这时需要将栈顶弹出
             * 要注意一些特殊的标志指令,这些指令不涉及到栈的操作
             */
            if ((flag & FLAG_CALAND) == 0 && (flag & FLAG_CALOR) == 0 &&
                insts.Count() > 0 && !insts.Last().Type.Equals("LBL") && !insts.Last().Type.Equals("NEXT"))
            {
                InstHelper.AddInst(insts, "POP");
            }
        }