//--------------------------------------------------------------------- protected FireRiskTable ReadFireRiskTable() { Dictionary <int, int> indexLineNumbers = new Dictionary <int, int>();; //speciesLineNumbers.Clear(); // in case parser re-used InputVar <int> ftindex = new InputVar <int>("Fuel Type Index"); InputVar <byte> rank = new InputVar <byte>("Fuel Type Rank"); //InputVar<ushort> minAge = new InputVar<ushort>("Minimum Age"); string lastColumn = "the " + rank.Name + " column"; FireRiskTable table = new FireRiskTable(); while (!AtEndOfInput && !namesThatFollowRankingMethod.Contains(CurrentName)) { StringReader currentLine = new StringReader(CurrentLine); // Fuel type index ReadValue(ftindex, currentLine); int lineNumber; if (indexLineNumbers.TryGetValue(ftindex.Value, out lineNumber)) { throw new InputValueException(ftindex.Value.String, "The fuel type {0} was previously used on line {1}", ftindex.Value.String, lineNumber); } else { indexLineNumbers[ftindex.Value] = lineNumber; } // 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[ftindex.Value] = new FireRiskParameters(rank.Value.Actual); GetNextLine(); } if (indexLineNumbers.Count == 0) { throw NewParseException("Expected a line starting with a fuel type index"); } return(table); }
//--------------------------------------------------------------------- public FireRiskRank(FireRiskTable rankTable) { this.rankTable = rankTable; }