Пример #1
0
class RecordPointer(object):
    readable(symbol=0, index=0, count=0, current=None)
    
    def __init__(self, symbol, data_set):
        self.__symbol = symbol
        self.__data_set = data_set
        self.__count = data_set.nrows
        self.__index = 0
        self.__book = Book(data_set[0])
        self.__timestamp = self.__book.timestamp()

    def more(self):
        return self.__index < self.__count

    def timestamp(self):
        return self.__timestamp

    def next(self):
        if not self.__book:
            return None
        result = self.__book
        self.__index += 1
        if self.__index == self.__count:
            self.__book = None
            self.__timestamp = sys.maxint
        else:
            self.__book = Book(self.__data_set[self.__index])
            self.__timestamp = self.__book.timestamp()
        return result
    
    def __str__(self):
        return self.__symbol + ':' + str(self.timestamp())
Пример #2
0
 def __init__(self, symbol, data_set):
     self.__symbol = symbol
     self.__data_set = data_set
     self.__count = data_set.nrows
     self.__index = 0
     self.__book = Book(data_set[0])
     self.__timestamp = self.__book.timestamp()
Пример #3
0
 def next(self):
     if not self.__book:
         return None
     result = self.__book
     self.__index += 1
     if self.__index == self.__count:
         self.__book = None
         self.__timestamp = sys.maxint
     else:
         self.__book = Book(self.__data_set[self.__index])
         self.__timestamp = self.__book.timestamp()
     return result