Exemplo n.º 1
0
// ----------------- METHOD TO ORDER THE LIST IN ASCENDING --------------------//
void orderListSitesAscending(Site *listSites){
    // Convert from a list to Array of web sites
    Site *temp;
    int Nelementos = getSizeOfListSites(listSites);
    Site *arraySites[Nelementos]; int i = 0;
    for(Site *tempSite = listSites; tempSite!=NULL; tempSite = tempSite->sig){
        temp = new Site(tempSite->getName(), tempSite->getAddress());
        temp->setListTokensMatches(tempSite->getListTokensMatches());
        arraySites[i] = temp;
        i++;
    }
    // END listToArray

    int j;                //Variables contadoras del ciclo.
    temp=NULL;             //Variable temporal.

    for (i=1;i<Nelementos;i++)
    {
       for (j=0; j < Nelementos-1 ;j++)
       {
          if (arraySites[j]->getSizeListTokens() < arraySites[j+1]->getSizeListTokens())//Condicion mayor-menor
          {
            temp=arraySites[j];
            arraySites[j]=arraySites[j+1];
            arraySites[j+1]=temp;
          }
       }
    }
    printArraySites(arraySites, Nelementos);
}
Exemplo n.º 2
0
Site *searchEngine(Site *listSites, Token *listTokens){
    bool match;Site *listMatchSites = NULL;
    Site *tempSiteToAdd;
    for(Site *tempSite = listSites; tempSite != NULL; tempSite = tempSite->sig){
        tempSiteToAdd = searchByWebSite(tempSite, listTokens);
        if(tempSiteToAdd->getListTokensMatches() != NULL)
        {
            //cout<<"SE ENCONTRARON VARIOS TOKENS en:"<<endl;
            //tempSiteToAdd->print();
            listMatchSites = addSiteToList(listMatchSites, tempSiteToAdd);
        }
    }
    return listMatchSites;
}