#NEWLINE# def update( self , value ) : #NEWLINE# #INDENT# '\n      Adds an old value with a fixed timestamp to the reservoir.\n      @param value     the value to be added\n    ' #NEWLINE# super ( ExponentiallyDecayingReservoir , self ) . update ( value ) #NEWLINE# timestamp = self . clock . time ( ) #NEWLINE# self . __rescaleIfNeeded ( ) #NEWLINE# priority = ( self . __weight ( ( timestamp - self . startTime ) ) / random . random ( ) ) #NEWLINE# self . count += 1 #NEWLINE# if ( self . count <= self . size ) : #NEWLINE# #INDENT# self . values [ priority ] = value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# first = min ( self . values ) #NEWLINE# if ( ( first < priority ) and ( priority not in self . values ) ) : #NEWLINE# #INDENT# self . values [ priority ] = value #NEWLINE# while ( first not in self . values ) : #NEWLINE# #INDENT# first = min ( self . values ) #NEWLINE# #UNINDENT# del self . values [ first ]