Mercurial > repos > yufei-luo > s_mart
comparison SMART/Java/Python/structure/Interval.py @ 18:94ab73e8a190
Uploaded
| author | m-zytnicki | 
|---|---|
| date | Mon, 29 Apr 2013 03:20:15 -0400 | 
| parents | 769e306b7933 | 
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 17:b0e8584489e6 | 18:94ab73e8a190 | 
|---|---|
| 338 @type fieldSep: string | 338 @type fieldSep: string | 
| 339 @param surrounder: string which optionally surround values | 339 @param surrounder: string which optionally surround values | 
| 340 @type surrounder: string | 340 @type surrounder: string | 
| 341 """ | 341 """ | 
| 342 tags = [] | 342 tags = [] | 
| 343 for name in self.tags: | 343 for name, value in self.tags.iteritems(): | 
| 344 value = self.tags[name] | |
| 345 if value == None: | 344 if value == None: | 
| 346 continue | 345 continue | 
| 347 if isinstance(value, basestring): | 346 if isinstance(value, basestring): | 
| 348 tags.append("%s%s%s%s%s" % (name, fieldSep, surrounder, self.tags[name], surrounder)) | 347 tags.append("%s%s%s%s%s" % (name, fieldSep, surrounder, value.replace("'", "\\'"), surrounder)) | 
| 349 elif type(value) is int: | 348 elif type(value) is int: | 
| 350 tags.append("%s%s%s%i%s" % (name, fieldSep, surrounder, self.tags[name], surrounder)) | 349 tags.append("%s%s%s%i%s" % (name, fieldSep, surrounder, value, surrounder)) | 
| 351 elif type(value) is float: | 350 elif type(value) is float: | 
| 352 tags.append("%s%s%s%f%s" % (name, fieldSep, surrounder, self.tags[name], surrounder)) | 351 tags.append("%s%s%s%f%s" % (name, fieldSep, surrounder, value, surrounder)) | 
| 353 else: | 352 else: | 
| 354 raise Exception("Do not know how to print '" + value + "'.") | 353 raise Exception("Do not know how to print '" + value + "'.") | 
| 355 if self.getName() != None: | 354 if self.getName() != None: | 
| 356 tags.append("%s%s%s%s%s" % ("Name", fieldSep, surrounder, self.getName(), surrounder)) | 355 tags.append("%s%s%s%s%s" % ("Name", fieldSep, surrounder, self.getName(), surrounder)) | 
| 357 return tagSep.join(tags) | 356 return tagSep.join(tags) | 
