public void IncrementFragmentCount(string fragment, int count = 1) { if (!FragmentCounts.ContainsKey(fragment)) { FragmentCounts.Add(fragment, 0); } FragmentCounts[fragment] += count; }
public int GetFragmentCount(string fragment) { if (!FragmentCounts.ContainsKey(fragment)) { return(0); } return(FragmentCounts[fragment]); }
public void DecrementFragmentCount(string fragment, int count = 1) { if (!FragmentCounts.ContainsKey(fragment)) { FragmentCounts.Add(fragment, 0); } FragmentCounts[fragment] -= count; if (FragmentCounts[fragment] < 0) { FragmentCounts[fragment] = 0; } }