コード例 #1
0
        public void Test20()
        {
            var code = @"
                st = new Stage
                    Name = 'st'
                p1 = new Process
                    Name = 'p1'
                p2 = new Process
                    Name = 'p2'
                w1 = new Work
                k1 = new Kanban
                    PullFrom = new Location
                        Stage = st
                        Path = '\'
                        Process = p1
                    PullTo = new Location
                        Stage = st
                        Path = '\'
                        Process = p2
                    Work = w1
            ";
            var jac  = new JacInterpreter();

            jac.Exec(code);
            var st = jac.GetStage("st");
            var k1 = jac.GetKanban("k1");
            var p1 = jac.GetProcess("p1");
            var p2 = jac.GetProcess("p2");
            var w1 = jac.GetWork("w1");

            Assert.IsNotNull(k1);
            Assert.IsNotNull(p1);
            Assert.IsNotNull(p2);
            Assert.IsNotNull(w1);
            Assert.AreEqual(k1.PullFrom.Stage, st);
            Assert.AreEqual(k1.PullFrom.Process.ID, p1.ID);
            Assert.AreEqual(k1.PullTo.Process.ID, p2.ID);
            Assert.AreEqual(k1.Work, w1);
        }
コード例 #2
0
        public void Test18()
        {
            var code = @"
                st = new Stage
                    Procs
                        add sink = new Process
                        add p1 = new Process
                            Name = 'MyProc'
                            Cio
                                add o1 = new CoMaxCost
            ";
            var jac  = new JacInterpreter();

            jac.Exec(code);
            var st = jac.GetStage("st");

            Assert.AreEqual(jac.GetProcess("MyProc")?.Name, "MyProc");
            Assert.AreEqual(jac.GetProcess("MyProc")?.Cios.Count(), 1);

            var code2 = @"
                w1 = new Work
                    Next = l1 = new Location
                        Stage = st
                        SubsetCache = st
                        Path = '\'
                        Process = p1 = new Process
                w2 = new Work
                    Current = w1.Next
                w3 = new Work
                    Previous = w2.Current
                w4 = new Work
                    Current = l1
            ";

            jac.Exec(code2);
            var w1 = jac.GetWork("w1");
            var w2 = jac.GetWork("w2");
            var w3 = jac.GetWork("w3");
            var w4 = jac.GetWork("w4");
            var p1 = jac.GetProcess("p1");
            var l1 = jac.GetLocation("l1");

            Assert.IsNotNull(p1);
            Assert.IsNull(w1.Previous);
            Assert.IsNull(w1.Current);
            Assert.AreEqual(w1.Next.SubsetCache, st);
            Assert.AreEqual(w1.Next.Process, p1);
            Assert.AreEqual(w2.Current.SubsetCache, w1.Next.SubsetCache);
            Assert.AreEqual(w2.Current.SubsetCache, st);
            Assert.AreEqual(w2.Current.Process, p1);
            Assert.AreEqual(w3.Previous.SubsetCache, st);
            Assert.AreEqual(w3.Previous.Process, p1);
            Assert.AreEqual(w4.Current, l1);

            var code3 = @"
                o1
                    ReferenceVarName = 'Weight'
                    Value = 500
            ";

            jac.Exec(code3);

            var o1 = jac["o1"] as CoMaxCost;

            Assert.IsNotNull(o1);
            Assert.AreEqual(o1.ReferenceVarName, JitVariable.From("Weight"));
            Assert.AreEqual(o1.Value, 500.0);
        }