//--------------------------------------------------------------------- protected EconomicRankTable ReadEconomicRankTable() { SpeciesLineNumbers.Clear(); // in case parser re-used InputVar <byte> rank = new InputVar <byte>("Economic Rank"); InputVar <ushort> minAge = new InputVar <ushort>("Minimum Age"); string lastColumn = "the " + minAge.Name + " column"; EconomicRankTable table = new EconomicRankTable(); while (!AtEndOfInput && !namesThatFollowRankingMethod.Contains(CurrentName)) { StringReader currentLine = new StringReader(CurrentLine); // Species name ISpecies species = ReadSpecies(currentLine); // Economic rank ReadValue(rank, currentLine); const byte maxRank = 100; if (rank.Value.Actual > maxRank) { throw new InputValueException(rank.Value.String, "Economic rank must be between 0 and {0}", maxRank); } // Minimum age ReadValue(minAge, currentLine); CheckNoDataAfter(lastColumn, currentLine); table[species] = new EconomicRankParameters(rank.Value.Actual, minAge.Value.Actual); GetNextLine(); } if (SpeciesLineNumbers.Count == 0) { throw NewParseException("Expected a line starting with a species name"); } return(table); }
//--------------------------------------------------------------------- public EconomicRank(EconomicRankTable rankTable) { this.rankTable = rankTable; }