/// <summary> /// Checks whether the supplied plan name exists in the list of known plans. /// This finds names using the current comparison settings, usually ignoring /// differences in whitespace, punctuation, etc. /// </summary> /// <param name="planName">The name of the plan to check for. Does not need to be exact.</param> /// <returns>Returns true if the plan name is known to exist.</returns> /// <exception cref="ArgumentNullException"/> public bool HasPlanName(string planName) { if (string.IsNullOrEmpty(planName)) { throw new ArgumentNullException(nameof(planName)); } return(PlansLookup.TryGetValue(planName, out var value)); }
/// <summary> /// Gets the plans matching a specific plan name. /// </summary> /// <param name="planName">The planname.</param> /// <returns>Returns the list of plans that match the provided name.</returns> public List <Plan> GetPlans(string planName) { if (string.IsNullOrEmpty(planName)) { throw new ArgumentNullException(nameof(planName)); } if (PlansLookup.TryGetValue(planName, out var plans)) { return(plans); } return(null); }
public void Reset() { PlansLookup.Clear(); NormalVotes.Clear(); RankedVotes.Clear(); ApprovalVotes.Clear(); IdentityVotesLookup.Clear(); FutureReferences.Clear(); UndoBuffer.Clear(); TallyTasks.Clear(); }
/// <summary> /// Gets the canonical plan name that matches the requested plan name. /// </summary> /// <param name="planName">The name of the plan to check for. Does not need to be exact.</param> /// <param name="canonicalName">Returns the canonical version of the name, if found.</param> /// <returns>Returns true if the requested name is found.</returns> /// <exception cref="ArgumentNullException"/> public bool TryGetPlanName(string planName, out string canonicalName) { if (string.IsNullOrEmpty(planName)) { throw new ArgumentNullException(nameof(planName)); } if (PlansLookup.TryGetValue(planName, out var value)) { canonicalName = value.First().Identity.Name; return(true); } canonicalName = null; return(false); }
/// <summary> /// Gets the lookup table for plans. /// </summary> /// <returns>Returns the list of all plans.</returns> public IEnumerable <Plan> GetPlans() { return(PlansLookup.Select(a => a.Value).SelectMany(b => b)); }