-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStop.py
31 lines (24 loc) · 963 Bytes
/
Stop.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import string
class Stop:
id = None
name = None
latitude = None
longitude = None
predictions = None
def __init__(self, id=None, name=None, latitude=None, longitude=None, predictions=None):
self.id = id
self.name = name
self.latitude = latitude
self.longitude = longitude
self.predictions = predictions if predictions is not None else []
def __str__(self):
try:
predictions = string.join([str(x) for x in self.predictions], ', ')
return "Stop %s" % string.join((self.id, self.name, self.latitude, self.longitude, predictions), ', ')
except TypeError as e:
print "Stop print error: %s" % e
return "Stop %s" % string.join((self.id, self.name, self.latitude, self.longitude), ', ')
def addPrediction(self, prediction):
self.predictions.append(prediction)
def clearPredictions(self):
self.predictions = []