def req_5_aux(self, temp_min, temp_max):
     char_rbt = None
     if mp.get(self.req_1_rbt, 7):
         char_rbt = mp.get(self.req_1_rbt, 7)['value']
     else:
         cmpfunc = lambda a, b: req_1_cmpfunc(7, a, b)
         char_rbt = rbt.newMap(cmpfunc)
         for music in catalog_iterator(self, 1):
             rbt.put(char_rbt, music, lt.getElement(music, 12))
         mp.put(self.req_1_rbt, 7, char_rbt)
     rango = rbt.values(char_rbt, temp_min, temp_max)
     reproducciones = lt.size(rango)
     return reproducciones
 def req_4_aux(self, min_temp, max_temp):
     char_rbt = None
     if mp.get(self.req_1_rbt, 22):
         char_rbt = mp.get(self.req_1_rbt, 22)['value']
     else:
         char_rbt = rbt.newMap(req_4_cmpfunc)
         for music in catalog_iterator(self, 1):
             rbt.put(char_rbt, music, lt.getElement(music, 12))
         mp.put(self.req_1_rbt, 22, char_rbt)
     rango = rbt.values(char_rbt, min_temp, max_temp)
     reproducciones = lt.size(rango)
     artistas = count_artists_2(rango, reproducciones)
     return (reproducciones, *artistas)
 def req_1(self, characteristic: int, minimo, maximo):
     char_rbt = None
     if mp.get(self.req_1_rbt, characteristic):
         char_rbt = mp.get(self.req_1_rbt, characteristic)
     else:
         cmpfunc = lambda a, b: req_1_cmpfunc(characteristic, a, b)
         char_rbt = rbt.newMap(cmpfunc)
         for music in catalog_iterator(self, 1):
             rbt.put(char_rbt, music, lt.getElement(music, 12))
         mp.put(self.req_1_rbt, characteristic, char_rbt)
     rango = rbt.values(char_rbt, minimo, maximo)
     reproducciones = lt.size(rango)
     artistas = count_artists(rango, reproducciones)
     return (reproducciones, artistas)
def newMap(omaptype, comparefunction):
    """
    Crea una tabla de simbolos ordenada.
    Args:
        maptype: El tipo de map ordenado a utilizar
                 'BST' o 'RBT'
    Returns:
       La tabla de símbolos ordenada sin elementos
    Raises:
        Exception
    """
    if (omaptype == 'BST'):
        return bst.newMap(comparefunction)
    else:
        return rbt.newMap(comparefunction)
 def req_3(self, inst_min, inst_max, temp_min: float, temp_max: float):
     char_rbt = None
     if mp.get(self.req_1_rbt, 21):
         char_rbt = mp.get(self.req_1_rbt, 21)['value']
     else:
         char_rbt = rbt.newMap(req_3_cmpfunc)
         for music in catalog_iterator(self, 1):
             rbt.put(char_rbt, music, [
                 lt.getElement(music, 14),
                 lt.getElement(music, 1),
                 lt.getElement(music, 7)
             ])
         mp.put(self.req_1_rbt, 21, char_rbt)
     rango = rbt.values(char_rbt, inst_min, inst_max)
     itera = ll_it.newIterator(rango)
     count = 0
     res_list = lt.newList()
     while ll_it.hasNext(itera):
         tempo = ll_it.next(itera)
         if tempo[2] >= temp_min and tempo[2] <= temp_max:
             count += 1
             if count <= 5:
                 lt.addLast(res_list, tempo)
     return count, res_list
 def req_2(self, en_min, en_max, dan_min: float, dan_max: float):
     char_rbt = None
     if mp.get(self.req_1_rbt, 20):
         char_rbt = mp.get(self.req_1_rbt, 20)['value']
     else:
         char_rbt = rbt.newMap(req_2_cmpfunc)
         for music in catalog_iterator(self, 1):
             rbt.put(char_rbt, music, [
                 lt.getElement(music, 14),
                 lt.getElement(music, 9),
                 lt.getElement(music, 4)
             ])
         mp.put(self.req_1_rbt, 20, char_rbt)
     rango = rbt.values(char_rbt, en_min, en_max)
     itera = ll_it.newIterator(rango)
     count = 0
     res_list = lt.newList()
     while ll_it.hasNext(itera):
         danceability = ll_it.next(itera)
         if danceability[2] >= dan_min and danceability[2] <= dan_max:
             count += 1
             if count <= 5:
                 lt.addLast(res_list, danceability)
     return count, res_list