コード例 #1
0
    /*==================================================================
    *  MOUSE HOVERING
    * ================================================================*/

    public void TileHover(Point tile)
    {
        if (selectedUnit != null)
        {
            return;
        }

        Unit unit = GetUnit(tile)?.unit;

        if (unit != null)
        {
            mapManager.RemoveMarkings(moves);

            hoverInfo = unit.GetMoves(mapManager);
            mapManager.Mark(tile, unit.hasActionLeft ? Marking.Orange : Marking.Red);

            Marking normalMove = unit.hasActionLeft ? Marking.Green : Marking.Orange;
            Marking energyMove = unit.hasActionLeft ? Marking.Energy : Marking.Red;

            foreach (Point p in hoverInfo)
            {
                mapManager.Mark(p, p.z == 0 ? normalMove : energyMove);
            }
        }
        else if (hoverInfo.Count > 0)
        {
            mapManager.RemoveMarkings(hoverInfo);
            hoverInfo.Clear();
        }
    }
コード例 #2
0
    /*==================================================================
    *  ACTION
    * ================================================================*/

    public void ShowAction(int index)
    {
        if (!SelectAction(index))
        {
            return;
        }

        mapManager.Mark(selectedUnit.unit.position, Marking.Orange);

        Marking mark = 0;

        if (action.type == ActionType.Attack)
        {
            mark = Marking.Red;
        }
        else if (action.type == ActionType.Buff)
        {
            mark = Marking.Purple;
        }

        mapManager.RemoveMarkings();
        foreach (TargetTile targetTile in targets)
        {
            Marking m = mark;
            if (targetTile.type == TargetType.NotValid)
            {
                m = Marking.Orange;
            }
            mapManager.Mark(targetTile.point, m);
        }
    }
コード例 #3
0
        //=============== Mapping Markings ================
        public static MarkingModel MapMarking(Marking marking, IUrlHelper urlHelper)
        {
            var markingViewModel = MappingConfig <Marking, MarkingModel> .Convert(marking);

            markingViewModel.Url = urlHelper.Link(Config.MarkingRoute, new { id = marking.PostId });
            return(markingViewModel);
        }
コード例 #4
0
        public void UpdateMarking(Marking marking)
        {
            SovaContext db = new SovaContext();

            db.Update(marking);
            db.SaveChanges();
        }
コード例 #5
0
 public void AssertMarkings(Marking m, Dictionary <int, int> markingsExpected)
 {
     foreach (var marking in markingsExpected)
     {
         Assert.AreEqual(marking.Value, m[marking.Key]);
     }
 }
コード例 #6
0
 private void setFieldsByMarkings(DailyMarking dm)
 {
     if (dm.markings.Count >= 1)
     {
         Marking mk = dm.markings[0];
         dm.entryOne = Convert.ToString(mk.hour).PadLeft(2, '0') + ":" + Convert.ToString(mk.minute).PadLeft(2, '0');
     }
     if (dm.markings.Count >= 2)
     {
         Marking mk = dm.markings[1];
         dm.exitOne = Convert.ToString(mk.hour).PadLeft(2, '0') + ":" + Convert.ToString(mk.minute).PadLeft(2, '0');
     }
     if (dm.markings.Count >= 3)
     {
         Marking mk = dm.markings[2];
         dm.entryTwo = Convert.ToString(mk.hour).PadLeft(2, '0') + ":" + Convert.ToString(mk.minute).PadLeft(2, '0');
     }
     if (dm.markings.Count >= 4)
     {
         Marking mk = dm.markings[3];
         dm.exitTwo = Convert.ToString(mk.hour).PadLeft(2, '0') + ":" + Convert.ToString(mk.minute).PadLeft(2, '0');
     }
     if (dm.markings.Count >= 5)
     {
         Marking mk = dm.markings[4];
         dm.entryThree = Convert.ToString(mk.hour).PadLeft(2, '0') + ":" + Convert.ToString(mk.minute).PadLeft(2, '0');
     }
     if (dm.markings.Count >= 6)
     {
         Marking mk = dm.markings[5];
         dm.exitThree = Convert.ToString(mk.hour).PadLeft(2, '0') + ":" + Convert.ToString(mk.minute).PadLeft(2, '0');
     }
 }
コード例 #7
0
        public virtual MarkerSetting MarkAssemblies(Confuser cr, Logger logger)
        {
            this.cr   = cr;
            this.proj = cr.param.Project;
            MarkerSetting ret = new MarkerSetting();

            ret.Assemblies = new AssemblySetting[proj.Count];

            InitRules();

            Marking setting = new Marking();

            using (setting.Level())
            {
                for (int i = 0; i < proj.Count; i++)
                {
                    using (setting.Level())
                        ret.Assemblies[i] = _MarkAssembly(proj[i], setting);
                    logger._Progress(i + 1, proj.Count);
                }
                if (proj.Packer != null)
                {
                    ret.Packer           = Packers[proj.Packer.Id];
                    ret.PackerParameters = Clone(proj.Packer);
                }
            }

            return(ret);
        }
コード例 #8
0
        public async Task <IActionResult> PutMarking(string id, Marking marking)
        {
            if (id != marking.id)
            {
                return(BadRequest());
            }

            if (!MarkingExists(marking.id))
            {
                return(NotFound());
            }

            _context.Entry(marking).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MarkingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #9
0
        public void Test1to1Fire()
        {
            var m = new Marking(2, new Dictionary <int, int> {
                { 0, 1 }, { 1, 0 }
            });
            var p = new MatrixPetriNet("p",
                                       new Dictionary <int, string> {
                { 0, "p0" },
                { 1, "p1" }
            },
                                       new Dictionary <int, string> {
                { 0, "t0" }
            },
                                       new Dictionary <int, List <InArc> >()
            {
                { 0, new List <InArc>()
                  {
                      new InArc(0)
                  } }
            },
                                       new Dictionary <int, List <OutArc> >()
            {
                { 0, new List <OutArc>()
                  {
                      new OutArc(1)
                  } }
            });

            Assert.AreEqual(true, p.IsEnabled(0, m));
            m = p.Fire(m);
            Assert.AreEqual(0, m[0]);
            Assert.AreEqual(1, m[1]);
        }
コード例 #10
0
        public void TestCreateMarking()
        {
            var m = new Marking(1);

            Assert.IsNotNull(m);
            Assert.AreEqual(0, m[0]);
        }
コード例 #11
0
        public Boolean updateJustificationMarking(Marking marking)
        {
            Boolean success = true;

            OleDbCommand cmd = DBConnection.getInstance.getDbCommand();

            cmd.CommandText = "UPDATE MARKING SET ID_JUSTIFICATION=? WHERE ID_MARKING=?";

            cmd.Parameters.Add("ID_JUSTIFICATION", OleDbType.Integer).Value = marking.idJustification;
            cmd.Parameters.Add("ID_MARKING", OleDbType.Integer).Value       = marking.idMarking;

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                Console.WriteLine("Erro ao alterar!" + e);
                success = false;
            }

            DBConnection.getInstance.closeConnection();

            return(success);
        }
コード例 #12
0
        public void TestInputTransition()
        {
            var m = new Marking(1, new Dictionary <int, int>
            {
                { 0, 0 }
            });
            var p = new MatrixPetriNet("p",
                                       new Dictionary <int, string> {
                { 0, "p0" }
            },
                                       new Dictionary <int, string>
            {
                { 0, "Ti" }
            },
                                       new Dictionary <int, List <InArc> >()
            {
            },
                                       new Dictionary <int, List <OutArc> >()
            {
                { 0, new List <OutArc>()
                  {
                      new OutArc(0)
                  } }
            });

            Assert.AreEqual(0, m[0]);
            Assert.IsTrue(p.IsEnabled(0, m));
            m = p.Fire(m);
            Assert.AreEqual(1, m[0]);
            Assert.IsTrue(p.IsEnabled(0, m));
            m = p.Fire(m);
            Assert.AreEqual(2, m[0]);
            Assert.IsTrue(p.IsEnabled(0, m));
        }
コード例 #13
0
 public void Mark(Point tile, Marking mark)
 {
     if (IsWithinBounds(tile))
     {
         tiles[tile.x, tile.y].SetMarking(markings[(int)mark]);
     }
 }
コード例 #14
0
        public void TestBifurcatingTransition() // a bifurcating transition
        {
            var m = new Marking(3,
                                new Dictionary <int, int>
            {
                { (int)Places.p1, 0 },
                { (int)Places.p2, 0 },
                { (int)Places.p3, 0 }
            });
            var p = CreatePetriNet.Parse(StdPetriNets.Bifurcation).CreateNet <GraphPetriNet>();

            m.Assert(p.Places, new Dictionary <string, int> {
                { "p1", 0 }, { "p2", 0 }, { "p3", 0 }
            });

            m.Set(p.Places, "p1", 1);
            m.Assert(p.Places, new Dictionary <string, int> {
                { "p1", 1 }, { "p2", 0 }, { "p3", 0 }
            });

            m = p.Fire(m);
            m.Assert(p.Places, new Dictionary <string, int> {
                { "p1", 0 }, { "p2", 1 }, { "p3", 1 }
            });
        }
コード例 #15
0
 public DrawingState(string name, Marking marking) : base(name, marking)
 {
     this.position          = new Vector();
     this.initialState      = false;
     this.destinationStates = new Dictionary <DrawingState, Tuple <string, int> >();
     this.originStates      = new Dictionary <DrawingState, int>();
 }
コード例 #16
0
ファイル: MemyController.cs プロジェクト: prolearner18/C-
        //lajkowanie
        public async Task <IActionResult> Like(int id, Marking user)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Account", "Identity", new { id = "Login" }));
            }
            var memy = db.Memy.SingleOrDefault(s => s.Id_mema == id);

            System.Security.Claims.ClaimsPrincipal currentUser = this.User;
            var memyyy = (from a in db.Marking
                          where a.Authorr == currentUser.Identity.Name && a.IdMema == id
                          select a).FirstOrDefault();

            memy.Like++;
            if (id != memy.Id_mema)
            {
                return(NotFound());
            }


            if (ModelState.IsValid && memyyy.IdMema == id && memyyy.CountLike == 0 &&
                memyyy.CountDislike == 0)
            {
                memyyy.CountLike    = 1;
                memyyy.CountDislike = 1;

                db.Update(memy);
                await db.SaveChangesAsync();

                return(RedirectToAction("Show", new { id = id }));
            }

            return(RedirectToAction("Show", new { id = id }));
        }
コード例 #17
0
 public void AssertMarkings <T1, T2>(Marking m, Dictionary <T1, T2> markingsExpected)
 {
     foreach (var marking in markingsExpected)
     {
         Assert.AreEqual(marking.Value, m[Convert.ToInt32(marking.Key)]);
     }
 }
コード例 #18
0
        public void TestSelfTransition()
        {
            var m = new Marking(1,
                                new Dictionary <int, int>
            {
                { (int)Places.p1, 0 }
            });
            var p = new MatrixPetriNet("p",
                                       new Dictionary <int, string> {
                { (int)Places.p1, "p1" }
            },
                                       new Dictionary <int, string>
            {
                { (int)Transitions.t1, "t1" }
            },
                                       new Dictionary <int, List <InArc> >()
            {
                { (int)Transitions.t1, new List <InArc>()
                  {
                      new InArc((int)Places.p1)
                  } }
            },
                                       new Dictionary <int, List <OutArc> >()
            {
                { (int)Transitions.t1, new List <OutArc>()
                  {
                      new OutArc((int)Places.p1)
                  } }
            });

            m[(int)Places.p1] = 1;
            Assert.AreEqual(1, m[(int)Places.p1]);
            m = p.Fire(m);
            Assert.AreEqual(1, m[(int)Places.p1]);
        }
コード例 #19
0
        public Boolean saveMarking(Marking marking)
        {
            Boolean success;

            OleDbCommand cmd      = DBConnection.getInstance.getDbCommand();
            String       pisPasep = marking.pisPasep.Replace(".", "").Replace("-", "").Replace(" ", "");

            cmd.CommandText = "INSERT INTO MARKING (NSR, MARKING_COUNTER, PIS_PASEP, MARKING_DAY, MARKING_MONTH, " +
                              "MARKING_YEAR, MARKING_HOUR, MARKING_MINUTE) VALUES (?,?,?,?,?,?,?,?)";

            cmd.Parameters.Add("NSR", OleDbType.Integer).Value             = marking.nsr;
            cmd.Parameters.Add("MARKING_COUNTER", OleDbType.Integer).Value = marking.cont;
            cmd.Parameters.Add("PIS_PASEP", OleDbType.VarChar).Value       = pisPasep;
            cmd.Parameters.Add("MARKING_DAY", OleDbType.Integer).Value     = marking.day;
            cmd.Parameters.Add("MARKING_MONTH", OleDbType.Integer).Value   = marking.month;
            cmd.Parameters.Add("MARKING_YEAR", OleDbType.Integer).Value    = marking.year;
            cmd.Parameters.Add("MARKING_HOUR", OleDbType.Integer).Value    = marking.hour;
            cmd.Parameters.Add("MARKING_MINUTE", OleDbType.Integer).Value  = marking.minute;

            try
            {
                cmd.ExecuteNonQuery();
                success = true;
            }
            catch (Exception e)
            {
                Console.WriteLine("Erro ao salvar!" + e);
                success = false;
            }

            DBConnection.getInstance.closeConnection();

            return(success);
        }
コード例 #20
0
        private void setHighlighterMUC()
        {
            Sgry.Azuki.Highlighter.KeywordHighlighter keywordHighlighter = new Sgry.Azuki.Highlighter.KeywordHighlighter();
            //keywordHighlighter.AddRegex("^.*", false, CharClass.DocComment);
            keywordHighlighter.AddRegex("^[A-Z]+ ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^#[A-Za-z0-9]* ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^#\\S*\\*", CharClass.Keyword);
            keywordHighlighter.AddRegex("^'@", CharClass.Keyword);
            keywordHighlighter.AddRegex("^'%\\S+ ", CharClass.Keyword);
            keywordHighlighter.AddRegex("^\\{ .*", CharClass.DocComment);
            keywordHighlighter.AddRegex("^\\}.*", CharClass.DocComment);
            keywordHighlighter.AddRegex("\\;.*", CharClass.Comment);
            //keywordHighlighter.AddEnclosure("{", "}", CharClass.Comment, true);
            azukiControl                  = new AzukiControl();
            azukiControl.Font             = new Font(setting.other.TextFontName, setting.other.TextFontSize, setting.other.TextFontStyle);
            azukiControl.Dock             = DockStyle.Fill;
            azukiControl.ShowsIconBar     = true;
            azukiControl.Highlighter      = keywordHighlighter;
            azukiControl.IconBarImageList = imglstIconBar;
            azukiControl.IconBarClicked  += AzukiControl_IconBarClicked;
            azukiControl.TextChanged     += AzukiControl_TextChanged;
            azukiControl.KeyDown         += AzukiControl_KeyDown;
            azukiControl.HScroll         += AzukiControl_CancelSien;
            azukiControl.VScroll         += AzukiControl_CancelSien;
            azukiControl.LocationChanged += AzukiControl_CancelSien;
            azukiControl.SizeChanged     += AzukiControl_CancelSien;
            azukiControl.CaretMoved      += AzukiControl_CaretMoved;
            azukiControl.AllowDrop        = true;
            azukiControl.DragOver        += AzukiControl_DragOver;
            azukiControl.DragDrop        += AzukiControl_DragDrop;
            azukiControl.Silence          = true;

            azukiControl.ColorScheme.ForeColor          = Color.FromArgb(setting.ColorScheme.Azuki_ForeColor);
            azukiControl.ColorScheme.BackColor          = Color.FromArgb(setting.ColorScheme.Azuki_BackColor);
            azukiControl.ColorScheme.IconBarBack        = Color.FromArgb(setting.ColorScheme.Azuki_IconBarBack);
            azukiControl.ColorScheme.LineNumberBack     = Color.FromArgb(setting.ColorScheme.Azuki_LineNumberBack_Normal);
            azukiControl.ColorScheme.LineNumberFore     = Color.FromArgb(setting.ColorScheme.Azuki_LineNumberFore_Normal);
            azukiControl.ColorScheme.SelectionBack      = Color.FromArgb(setting.ColorScheme.Azuki_SelectionBack_Normal);
            azukiControl.ColorScheme.SelectionFore      = Color.FromArgb(setting.ColorScheme.Azuki_SelectionFore_Normal);
            azukiControl.ColorScheme.MatchedBracketBack = Color.FromArgb(setting.ColorScheme.Azuki_MatchedBracketBack_Normal);
            azukiControl.ColorScheme.MatchedBracketFore = Color.FromArgb(setting.ColorScheme.Azuki_MatchedBracketFore_Normal);
            azukiControl.ColorScheme.SetColor(CharClass.Keyword, Color.FromArgb(setting.ColorScheme.Azuki_Keyword), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Comment, Color.FromArgb(setting.ColorScheme.Azuki_Comment), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.DocComment, Color.FromArgb(setting.ColorScheme.Azuki_DocComment), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Number, Color.FromArgb(setting.ColorScheme.Azuki_Number), Color.Transparent);
            azukiControl.ColorScheme.SetColor(CharClass.Delimiter, Color.FromArgb(setting.ColorScheme.Azuki_Number), Color.Transparent);

            MarkingInfo info = new MarkingInfo(1, "TraceInfo");

            Marking.Register(info);
            TextDecoration dec = new BgColorTextDecoration(Color.DarkGoldenrod);

            azukiControl.ColorScheme.SetMarkingDecoration(1, dec);

            this.Controls.Add(azukiControl);

            frmSien        = new FrmSien(setting);
            frmSien.parent = main;
            frmSien.Show();
        }
コード例 #21
0
        public Boolean updateMarking(Marking marking)
        {
            Boolean success = true;

            OleDbCommand cmd      = DBConnection.getInstance.getDbCommand();
            String       pisPasep = marking.pisPasep.Replace(".", "").Replace("-", "").Replace(" ", "");

            cmd.CommandText = "UPDATE MARKING SET NSR=?, MARKING_COUNTER=?, PIS_PASEP=?, MARKING_DAY=?, MARKING_MONTH=?, MARKING_YEAR=?, MARKING_HOUR=?, MARKING_MINUTE=? WHERE ID_MARKING=?";

            cmd.Parameters.Add("NSR", OleDbType.Integer).Value             = marking.nsr;
            cmd.Parameters.Add("MARKING_COUNTER", OleDbType.Integer).Value = marking.cont;
            cmd.Parameters.Add("PIS_PASEP", OleDbType.VarChar).Value       = pisPasep;
            cmd.Parameters.Add("MARKING_DAY", OleDbType.Integer).Value     = marking.day;
            cmd.Parameters.Add("MARKING_MONTH", OleDbType.Integer).Value   = marking.month;
            cmd.Parameters.Add("MARKING_YEAR", OleDbType.Integer).Value    = marking.year;
            cmd.Parameters.Add("MARKING_HOUR", OleDbType.Integer).Value    = marking.hour;
            cmd.Parameters.Add("MARKING_MINUTE", OleDbType.Integer).Value  = marking.minute;
            cmd.Parameters.Add("ID_MARKING", OleDbType.Integer).Value      = marking.idMarking;

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                Console.WriteLine("Erro ao alterar!" + e);
                success = false;
            }

            DBConnection.getInstance.closeConnection();

            return(success);
        }
コード例 #22
0
        public void TestDrainTransition()
        {
            var m = new Marking(1, new Dictionary <int, int>
            {
                { 0, 5 }
            });
            var p = new MatrixPetriNet("p",
                                       new Dictionary <int, string> {
                { 0, "p0" }
            },
                                       new Dictionary <int, string>
            {
                { 0, "Ti" }
            },
                                       new Dictionary <int, List <InArc> >()
            {
                { 0, new List <InArc>()
                  {
                      new InArc(0)
                  } }
            },
                                       new Dictionary <int, List <OutArc> >()
            {
            });

            for (int i = 5; i >= 0; i--)
            {
                Assert.AreEqual(i, m[0]);
                Assert.AreEqual(i > 0, p.IsEnabled(0, m));
                m = p.Fire(m);
            }
        }
コード例 #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="m1Name"></param>
        /// <param name="m2Name"></param>
        /// <param name="coverPlaceNames"></param>
        /// <returns>
        /// return 1: Marking 1 > Marking 2
        /// return 0: Can not compare Marking 1 with Marking 2
        /// return -1: Marking 1 < Marking 2
        /// </returns>
        private int CompareTwoMarking(int m1Name, int m2Name, ref List <int> coverPlaceNames)
        {
            bool    isGreater = true;
            bool    isLess    = true;
            Marking m1        = this.m_Reachability.GetMarkingFromMarkingName(m1Name);
            Marking m2        = this.m_Reachability.GetMarkingFromMarkingName(m2Name);

            foreach (int p in coverPlaceNames)
            {
                int value1 = m1.GetMarkingValueFromPlaceName(p);
                int value2 = m2.GetMarkingValueFromPlaceName(p);
                if (value1 > value2)
                {
                    isLess = false;
                }
                else
                {
                    isGreater = false;
                }
            }
            if (isGreater)
            {
                return(1);
            }
            else if (isLess)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
コード例 #24
0
ファイル: Hexamaze.cs プロジェクト: CaitSith2/KtaneStuff
        private static string getMarkingSvg(this Marking marking, double hexWidth, double x, double y, bool useCssClass = false, bool useAttributes = false, double strokeWidth = 2, bool includeDot = false)
        {
            var attr = useAttributes ? $" fill='none' stroke='#f0faff' stroke-width='{strokeWidth}'" : null;
            var dot  = includeDot ? $"<circle{(useAttributes ? " fill='#f0faff'" : null)}{(useCssClass ? " class='dot'" : null)} cx='{x}' cy='{y}' r='{hexWidth / 20}' />" : null;

            switch (marking)
            {
            case Marking.Circle:
                return($"{dot}<circle{attr}{(useCssClass ? " class='marking circle'" : null)} cx='{x}' cy='{y}' r='{hexWidth / 4}' />");

            case Marking.TriangleUp:
                return($"{dot}<polygon{attr}{(useCssClass ? " class='marking triangle-up'" : null)} points='{Enumerable.Range(0, 3).Select(i => (i + .25) * 2 * Math.PI / 3).Select(angle => $"{x + hexWidth * .325 * Math.Cos(angle)},{y + hexWidth * .325 * Math.Sin(angle)}").JoinString(" ")}' />");

            case Marking.TriangleDown:
                return($"{dot}<polygon{attr}{(useCssClass ? " class='marking triangle-down'" : null)} points='{Enumerable.Range(0, 3).Select(i => (i + .75) * 2 * Math.PI / 3).Select(angle => $"{x + hexWidth * .325 * Math.Cos(angle)},{y + hexWidth * .325 * Math.Sin(angle)}").JoinString(" ")}' />");

            case Marking.TriangleLeft:
                return($"{dot}<polygon{attr}{(useCssClass ? " class='marking triangle-left'" : null)} points='{Enumerable.Range(0, 3).Select(i => (i + .5) * 2 * Math.PI / 3).Select(angle => $"{x + hexWidth * .325 * Math.Cos(angle)},{y + hexWidth * .325 * Math.Sin(angle)}").JoinString(" ")}' />");

            case Marking.TriangleRight:
                return($"{dot}<polygon{attr}{(useCssClass ? " class='marking triangle-right'" : null)} points='{Enumerable.Range(0, 3).Select(i => i * 2 * Math.PI / 3).Select(angle => $"{x + hexWidth * .325 * Math.Cos(angle)},{y + hexWidth * .325 * Math.Sin(angle)}").JoinString(" ")}' />");

            case Marking.Hexagon:
                return($"{dot}<polygon{attr}{(useCssClass ? " class='marking hexagon'" : null)} points='{Enumerable.Range(0, 6).Select(i => i * Math.PI / 3).Select(angle => $"{x + hexWidth * .325 * Math.Cos(angle)},{y + hexWidth * .325 * Math.Sin(angle)}").JoinString(" ")}' />");
            }
            return(dot);
        }
コード例 #25
0
        private void CaculateCriticalTransitionOperationPlaces()
        {
            List <int> operationPlaces = this.m_Reachability.GetOperationPlaceNames();

            foreach (KeyValuePair <int, HashSet <int> > item in this.m_MinimalTCriticalMTSIs)
            {
                this.m_CriticalTransitionOperationPlaces.Add(item.Key, new List <int>());
                foreach (int operationPlace in operationPlaces)
                {
                    if (this.m_Reachability.IncidenceMatrix.GetValueFromMarkingNameAndTransitionName(item.Key, operationPlace) > 0)
                    {
                        this.m_CriticalTransitionOperationPlaces[item.Key].Add(operationPlace);
                        continue;
                    }
                    bool check = true;
                    foreach (int markingName in item.Value)
                    {
                        Marking m = this.m_Reachability.GetMarkingFromMarkingName(markingName);
                        if (m.GetMarkingValueFromPlaceName(operationPlace) != 0)
                        {
                            check = false;
                            break;
                        }
                    }
                    if (!check)
                    {
                        this.m_CriticalTransitionOperationPlaces[item.Key].Add(operationPlace);
                    }
                }
            }
        }
コード例 #26
0
ファイル: DataServiceTests.cs プロジェクト: ivanspajic/SOVA
        public void GetBookmarkBySubmissionAndUserIds_ValidArguments()
        {
            // Arrange
            SOVAContext       databaseContext   = new SOVAContext(_connectionString);
            MarkingRepository markingRepository = new MarkingRepository(databaseContext);

            int submissionId = 19;

            User testUser = EnsureTestUserExistsThroughContext_ReturnsTestUser();

            Marking marking = databaseContext.Markings.Find(submissionId, testUser.Id);

            if (marking == null)
            {
                databaseContext.Markings.Add(new Marking
                {
                    SubmissionId = submissionId,
                    UserId       = testUser.Id
                });
            }

            databaseContext.SaveChanges();

            // Act
            bool bookmarked = markingRepository.IsMarked(submissionId, testUser.Id);

            // Assert
            Assert.True(bookmarked);

            // Clean-Up
            marking = databaseContext.Markings.FirstOrDefault(b => b.SubmissionId == submissionId && b.UserId == testUser.Id);
            databaseContext.Markings.Remove(marking);

            databaseContext.SaveChanges();
        }
コード例 #27
0
ファイル: CompoundState.cs プロジェクト: marquesm91/UltraDES
 public CompoundState(AbstractState s1, AbstractState s2, Marking marking)
 {
     S1 = s1;
     S2 = s2;
     Marking = marking;
     _hashcode = s1.GetHashCode() ^ s2.GetHashCode();
 }
コード例 #28
0
        private void MarkMember(MemberSetting parent, IMemberDefinition mem, Marking mark, List <MemberSetting> settings)
        {
            MemberSetting ret = MarkMember(parent, mem, mark);

            ret.Parameters = mark.CurrentConfusions;
            settings.Add(ret);
        }
コード例 #29
0
        private void MarkType(ModuleDefinition mod, TypeDefinition type, Marking mark, List <MemberSetting> settings)
        {
            MemberSetting ret = MarkType(mod, type, mark);

            ret.Parameters = mark.CurrentConfusions;

            using (mark.Level())
            {
                List <MemberSetting>     memSettings = new List <MemberSetting>();
                TypeDefinition           typeDef     = ret.Object as TypeDefinition;
                List <IMemberDefinition> mems        = new List <IMemberDefinition>(typeDef.Methods.OfType <IMemberDefinition>().Concat(
                                                                                        typeDef.Fields.OfType <IMemberDefinition>()).Concat(
                                                                                        typeDef.Properties.OfType <IMemberDefinition>()).Concat(
                                                                                        typeDef.Events.OfType <IMemberDefinition>()));
                foreach (var i in mems)
                {
                    using (mark.Level())
                        MarkMember(ret, i, mark, memSettings);
                }

                foreach (var i in typeDef.NestedTypes)
                {
                    using (mark.Level())
                        MarkType(mod, i, mark, memSettings);
                }

                ret.Members = memSettings.ToArray();
            }
            settings.Add(ret);
        }
コード例 #30
0
 internal void AssertMarkings(Marking m, Dictionary <Places, double> markingsExpected)
 {
     foreach (var marking in markingsExpected)
     {
         Assert.AreEqual(marking.Value, m[Convert.ToInt32(marking.Key)]);
     }
 }
コード例 #31
0
        protected virtual AssemblySetting MarkAssembly(ProjectAssembly asm, Marking mark)
        {
            AssemblySetting ret = new AssemblySetting(asm.Resolve(cr.param.Project.BasePath));

            ret.IsMain = asm.IsMain;
            ApplyRules(ret.Assembly, mark);
            return(ret);
        }
コード例 #32
0
ファイル: Place.cs プロジェクト: PatrionDigital/syndicatenet
 /// <summary>
 /// 
 /// </summary>
 /// <param name="housingSystem"></param>
 /// <param name="cap"></param>
 public Place(Systems.PlaceTransitionNet housingSystem, Marking.Capacity cap)
     : base((Systems.NetSystem)housingSystem)
 {
     Type = Nodes.Node.NodeType.PLACE;
     Marking = 0;
     Capacity = cap;
     placeID = housingSystem.AddPlace(this);
 }
コード例 #33
0
        public CompoundExpandedState(AbstractState s1, AbstractState s2, Marking marking)
            : base(s1, s2, marking)
        {
            var i = s1 is ExpandedState
                ? ((ExpandedState)s1).Tasks
                : s1 is CompoundExpandedState ? ((CompoundExpandedState)s1).Tasks : 0;
            var j = s2 is ExpandedState
                ? ((ExpandedState)s2).Tasks
                : s2 is CompoundExpandedState ? ((CompoundExpandedState)s2).Tasks : 0;

            Tasks = i + j;
        }
コード例 #34
0
ファイル: State.cs プロジェクト: marquesm91/UltraDES
 public State(string alias, Marking marking = Marking.Unmarked)
 {
     Alias = alias;
     Marking = marking;
 }
コード例 #35
0
ファイル: ExpandedState.cs プロジェクト: marquesm91/UltraDES
 public ExpandedState(string alias, uint tasks, Marking marking = Marking.Unmarked)
     : base(alias, marking)
 {
     Tasks = tasks;
 }
コード例 #36
0
ファイル: Programme.cs プロジェクト: CBenghi/UnnItBooster
        internal void FetchMarks()
        {
            string IndividualUrl = getMarksUrl();
            if (IndividualUrl == string.Empty)
                return;
            string individualReport = ReportServer.getSqlReport(IndividualUrl);
            if (individualReport == "")
                return;
            try
            {
                string xml = individualReport.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "");

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(new StringReader(xml));

                var tab1 = xmlDoc.GetElementsByTagName("table1");
                XmlElement tab1_1 = (XmlElement)tab1[0];
                XmlNodeList detailName = tab1_1.GetElementsByTagName("Detail", "Transcript");
                StudentName = detailName[0].Attributes["stu_surn"].Value;
                ProgrammeMode = detailName[0].Attributes["fca_name"].Value;

                var tab2 = xmlDoc.GetElementsByTagName("table2");
                XmlElement tab2_1 = (XmlElement)tab2[0];
                XmlNodeList detailTab2 = tab2_1.GetElementsByTagName("Detail", "Transcript");
                ProgrammeName = detailTab2[0].Attributes["textbox10"].Value;

                var tab3 = xmlDoc.GetElementsByTagName("table3");
                XmlElement tab3_1 = (XmlElement)tab3[0];
                XmlNodeList details = tab3_1.GetElementsByTagName("Detail", "Transcript");
                Marks = new List<Marking>();

                foreach (XmlElement item in details)
                {
                    Marking mk = new Marking();
                    mk.Credits = Convert.ToInt32(item.Attributes["smr_cred"].Value);
                    string[] MarkSplit = item.Attributes["smr_agrm"].Value.Split(new string[] { " " }, StringSplitOptions.None);
                    string mark = MarkSplit[0];
                    try
                    {
                        mk.Mark = Convert.ToInt32(mark);
                        mk.MarkStatus = MarkSplit[1];
                    }
                    catch
                    {
                    }
                    mk.Level = Convert.ToInt32(item.Attributes["smr_levc"].Value);
                    mk.Code = Convert.ToString(item.Attributes["mod_code"].Value);
                    string moduleName = item.Attributes["textbox17"].Value;
                    mk.Title = moduleName;
                    Marks.Add(mk);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }