Skip to content

Commit

Permalink
Added System.getStation
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Feb 15, 2015
1 parent 12d4d75 commit 4f4177b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,20 @@ def distanceTo(self, other):

return distSq ** 0.5

def getStation(self, stationName):
"""
Quick case-insensitive lookup of a station name within the
stations in this system.
Returns:
Station() object if a match is found,
otherwise None.
"""
upperName = stationName.upper()
for station in self.stations:
if station.dbname.upper() == upperName:
return station
return None

def name(self):
return self.dbname
Expand Down

0 comments on commit 4f4177b

Please sign in to comment.