public void AppendPrint(int indent, StringBuilder buf) { Helper.PrintASTIndentLine(string.Join(", ", Vars), indent, buf); if (Vals != null) { Vals.AppendPrint(indent + 1, buf); } }
public void SetKey(string Key, string Value) { if (Capacity <= 0) { return; } // If key does exist, we're returning from here if (Vals.ContainsKey(Key)) { Vals.Add(Key, Value); GetKey(Key); return; } if (Vals.Count >= Capacity) { IEnumerator <string> enumerator = Lists[Minimum].GetEnumerator(); if (enumerator.MoveNext()) { string evit = enumerator.Current; Lists[Minimum].Remove(evit); Vals.Remove(evit); Counts.Remove(evit); } else { throw new ArgumentOutOfRangeException("Invalid access at SetKey!"); } } Console.WriteLine("Hereererre"); // If the key is new, insert the value and current // min should be 1 of course if (!Vals.ContainsKey(Key)) { Vals.Add(Key, Value); } if (!Counts.ContainsKey(Key)) { Counts.Add(Key, 1); } Minimum = 1; if (!Lists.ContainsKey(Minimum)) { Lists.Add(Minimum, new LinkedHashSet <string>()); } else { Lists[Minimum].Add(Key); } }
public void OnSliderMaxValueReached() { //Debug.Log(lastVal); if (lastVal != Vals.max) { scrubCount++; m_Throwable.ManuallyDetatchThisObject(); gameObject.SetActive(false); } lastVal = Vals.max; }
public static bool IsValidFollower(Vals val1, Vals val2) { if (val1 == Vals.IF) return val2 == Vals.THEN; if (val1 == Vals.THEN) return val2 == Vals.ENDIF || val2 == Vals.ELSEIF || val2 == Vals.ELSE; if (val1 == Vals.ENDIF) return val2 == Vals.IF; if (val1 == Vals.ELSE) return val2 == Vals.ENDIF; if (val1 == Vals.ELSEIF) return val2 == Vals.THEN; return false; }
public PokerHand(string hand) { Hand = Hand.Trim(); HighCards = new TupleList <string, int>(); foreach (var Card in Hand) { if (Ranks.ContainsKey(Card)) { Vals.Add(Ranks[Card]); } } foreach (var Card in Hand) { if (Suits.ContainsKey(Card)) { Suits.Add(Suits[Card]) } } }
public IActionResult EditRecord(Vals vals, Emps newemps) { List <Emps> emps = empRepository.LoadEmps(); switch (vals.Operation) { case "EDIT": emps[newemps.ID - 1] = newemps; break; default: // ADD newemps.ROWID = Guid.NewGuid().ToString(); emps.Add(newemps); break; } int i = empRepository.SaveEmps(emps); return(RedirectToAction("Index")); }
public string GetKey(string key) { if (!Vals.ContainsKey(key)) { return(""); } // Get the count from counts map Int64 Count = Counts[key]; // Increase the counter if (!Counts.ContainsKey(key)) { Counts.Add(key, Count + 1); } // Remove the element from the counter to LinkedHashSet Lists[Count].Remove(key); // When the current min does not have any data, next // one would be the min if (Count == Minimum && Lists[Count].Count == 0) { Minimum += Minimum + 1; } if (!Lists.ContainsKey(Count + 1)) { Lists.Add(Count + 1, new LinkedHashSet <string>()); } Lists[Count].Add(key); return(Vals[key]); }
public void AppendPrint(int indent, StringBuilder buf) { Helper.PrintASTIndentLine("array value list", indent, buf); Vals.AppendPrint(indent + 1, buf); }
public IActionResult Index(List <Emps> emps, Vals vals, Emps newemps) { if (!empRepository.CheckUser(User)) { return(View("RejectLogin")); } bool isAdmin = empRepository.CheckAdmin(User); ViewBag.isAdmin = isAdmin; ViewBag.mode = ""; if (emps.Count == 0) { emps = empRepository.LoadEmps(); } if (!String.IsNullOrEmpty(vals.Operation) && vals.Operation == "CHARTS") { ViewBag.mode += " mode: " + vals.Operation; ViewBag.title = "Диаграммы"; ViewBag.chartDecades = empRepository.GetJSON(emps, "DECADES"); ViewBag.chartGenders = empRepository.GetJSON(emps, "GENDERS"); return(View("ShowCharts", emps)); } if (isAdmin) { if (!String.IsNullOrEmpty(vals.Operation)) { if ((vals?.SourceID != null) && (vals.SourceID != 0)) { ViewBag.mode = "SourceID: " + vals.SourceID.ToString(); } else { ViewBag.mode = "SourceID is not set"; } switch (vals.Operation) { case "DELETE": if ((vals.SourceID > 0) && (vals.SourceID <= emps.Count) && (vals.SourceROWID != null)) { if (emps[vals.SourceID - 1].ROWID == vals.SourceROWID) { emps.Remove(emps[vals.SourceID - 1]); } } int res = empRepository.SaveEmps(emps); emps = empRepository.LoadEmps(); ViewBag.mode += " mode: " + vals.Operation + " emps.Count: " + emps.Count; break; case "EDIT": ViewBag.mode += " mode: " + vals.Operation; ViewBag.title = "Добавление сотрудника"; ViewBag.position = empRepository.GetPositions(emps[vals.SourceID - 1].Position); return(View("EditEmp", emps[vals.SourceID - 1])); //break; case "ADD": ViewBag.mode += " mode: " + vals.Operation; ViewBag.title = "Редактирование сотрудника"; ViewBag.position = empRepository.GetPositions(String.Empty); return(View("EditEmp", new Emps())); //break; case "RENEW": emps = empRepository.InitEmps(null); res = empRepository.SaveEmps(emps); break; default: ViewBag.mode += " mode: " + vals.Operation; break; } } } ViewBag.title = "Главная"; return(View(emps)); }
public void OnSliderMinValueReached() { lastVal = Vals.min; }