private OptionInfo GetInfo(OptionSpecifier opt) { int id = opt.GetId(); //Debug.Assert(id > 0 id - 1 < getNumOptions() ,"Invalid Option ID."); return(_optionInfos[id - 1]); }
/// matches - Predicate for whether this option is part of the /// given option (which may be a group). /// /// Note that matches against options which are an alias should never be /// done -- aliases do not participate in matching and so such a query will /// always be false. public bool Matches(OptionSpecifier opt) { // Aliases are never considered in matching, look through them. var alias = GetAlias(); if (alias.IsValid()) { return(alias.Matches(opt)); } // Check exact match. if (GetId() == opt.GetId()) { return(true); } var @group = GetGroup(); if (@group.IsValid()) { return(@group.Matches(opt)); } return(false); }
public Option GetOption(OptionSpecifier opt) { var id = opt.GetId(); if (id == 0) { return(new Option(null, null)); } Debug.Assert((id - 1) < GetNumOptions(), "Invalid ID."); return(new Option(GetInfo(id), this)); }
public void EraseArg(OptionSpecifier id) { _optRanges.Remove(id.GetId()); }