Exemplo n.º 1
0
int main(int argv, char *argc[])
{
    FILE *fp;//name of clones (sorted)
    FILE  *fp1;//clusters

    int return_value;

    fp = fopen(argc[1],"r");
    fp1=fopen(argc[2],"r");
    //printf("HERE\n");
    //fp2=fopen(arg[c],"w");

    if (argv == 4) {
        minLeftSupport = atoi(argc[3]);
        minRightSupport = minLeftSupport;
    }
    else if (argv == 5) {
        minLeftSupport = atoi(argc[3]);
        minRightSupport = atoi(argc[4]);
    }
    return_value = fscanf(fp,"%i\n",&numClones);
    if( return_value != 1)
    {
        perror( "Error on fscanf");
        exit( 1);
    }
    //printf("%i\n", numClones);
    listClones = (cloneHead*) malloc((numClones+1)*sizeof(cloneHead));
    listClusters = (clusHead *) malloc(maxNumCluster*sizeof(clusHead));
    //printf("%i\n", strcmp("149","14:"));
    //printf("%i\n",strcmp("HWI-EAS90__20B1UAAXX:6:17:580:368.1","HWI-EAS90__20B1UAAXX:6:175:802:480.1"));
    for (int count=0; count<=maxNumCluster; count++)
    {
        listClusters[count].cloneSup=0;
        listClusters[count].clustProb=0;
    }

    readClones(fp);
// printf("JJ\n");
    //char *test;
    //test = (char *)malloc(50*sizeof(char));
    //strcpy(test, "HWI-EAS90__20B1UAAXX:6:175:841:975.1");
    //printf("%i\n", findCloneId(test));
    readClusters(fp1);
// printf("HH\n");
    //  int total=0;
    /*for (int count=0; count<numClusters; count++)
      {
        if (listClusters[count].cloneSup==1) fprintf(fp2,"%i %i\n", count, listClusters[count].cloneSup);
        //total=total+listClusters[count].cloneSup;
        }*/
    //  printf("TOTAL:%i\n", total);
    /*  for (int count=0; count<numClusters; count++)
    {
      //    printf("%i %f\n",count, listClusters[count].clustProb);
      }*/
    setCover();
    //printf("TOTAL %i\n", total);
    //fclose(fp2);
}
Exemplo n.º 2
0
int main(int argc,char *argv[]) {


	int num_houses,num_schools;
	int u,v,weight;
	

	if(scanf("%d %d",&num_houses,&num_schools) != 2) {
		printError();
	}

	
	Graph *g = graph_new(num_houses+num_schools);
	g->num_houses = num_houses;
	g->num_schools = num_schools;
	g->number_of_vertices = num_houses+num_schools;

	while(scanf("%d %d %d",&u,&v,&weight) == 3) {

		if(u < 0 || v < 0 
		|| u>=(g->number_of_vertices) || v>=(g->number_of_vertices) || weight < 0){
			printError();
		}
		else {
			// the 0 represents unvisted 
			graph_add_edge(g,u,v,0);
			graph_add_edge(g,v,u,0);
			//adding weights 
			g->vertices[u].edges[g->vertices[u].num_edges-1].weight = weight;
			g->vertices[v].edges[g->vertices[v].num_edges-1].weight = weight;
		}

	}
	// checking if graph is connected 
	if(!graph_check_connected(g,0)) {
		fprintf(stderr, "Graph is not connected\n");
		exit(EXIT_FAILURE);
	}

	
	Universe *Uni = create_all_sets(g->num_schools,g->num_houses);

	//running Dijkstra on each school vertex
	for(int i=num_houses;i<g->number_of_vertices;i++) {

		Dijkstra(g,i,Uni,min_func);

	}

	setCover(Uni,g->num_houses);



	free_graph(g);
	
	return 0;
}
Exemplo n.º 3
0
PropertiesDialog::PropertiesDialog(QWidget *parent):QDialog(parent)
{
    setupUi(this);
    QObject::connect(AlbumBox,SIGNAL(textEdited(QString)),this,SLOT(propChanged()));
    QObject::connect(ArtistBox,SIGNAL(textEdited(QString)),this,SLOT(propChanged()));
    QObject::connect(TitleBox,SIGNAL(textEdited(QString)),this,SLOT(propChanged()));
    QObject::connect(localsetButton,SIGNAL(clicked()),this,SLOT(setCover()));
    QObject::connect(removeButton,SIGNAL(clicked()),this,SLOT(removeCover()));
    QObject::connect(this,SIGNAL(accepted()),this,SLOT(write()));
    coverChanged=false;
}
Exemplo n.º 4
0
void PropertiesDialog::loadPreviousCover()
{
	int current = coverPageNumberLabel->text().toInt();
	if(current!=1)
	{
		updateCoverPageNumberLabel(current-1);
		ThumbnailCreator tc(basePath+comics[0].path,"",current-1);
		tc.create();
		setCover(tc.getCover());
		repaint();

		if((current-1) ==  1)
		{
			showPreviousCoverPageButton->setDisabled(true);
		}

		showNextCoverPageButton->setEnabled(true);
		//busyIndicator->show();
		if(current-1 != *(comics.at(0).info.coverPage))
			coverChanged = true;
		else
			coverChanged = false;
	}
}
Exemplo n.º 5
0
void PropertiesDialog::setComics(QList<ComicDB> comics)
{
	this->comics = comics;

	ComicDB comic = comics.at(0);

	if(comic.info.title != NULL)
		title->setText(*comic.info.title);

	if(comics.length()==1 &&comic.info.coverPage != NULL)
	{
		coverPageEdit->setText(QString::number(*comic.info.coverPage));
		coverPageValidator.setRange(1,*comic.info.numPages);
		coverPageEdit->setValidator(&coverPageValidator);
		//----------
		int coverPage = *comic.info.coverPage;
		coverPageNumberLabel->setText(QString::number(coverPage));
		coverPageNumberLabel->adjustSize();
		
		showPreviousCoverPageButton->setEnabled(true);
		showNextCoverPageButton->setEnabled(true);
		
		if(coverPage == 1)
			showPreviousCoverPageButton->setDisabled(true);
		if(coverPage == *comic.info.numPages)
			showNextCoverPageButton->setDisabled(true);

		coverChanged = false;
		coverBox->show();

		if(!QFileInfo(basePath+comics[0].path).exists())
		{
			QMessageBox::warning(this,tr("Not found"),tr("Comic not found. You should update your library."));
			showPreviousCoverPageButton->setDisabled(true);
			showNextCoverPageButton->setDisabled(true);
		}
	}
	/*if(comic.info.numPages != NULL)
	numPagesEdit->setText(QString::number(*comic.info.numPages));*/


	if(comic.info.number != NULL)
		numberEdit->setText(QString::number(*comic.info.number));
	if(comic.info.isBis != NULL)
		isBisCheck->setChecked(*comic.info.isBis);
	if(comic.info.count != NULL)
		countEdit->setText(QString::number(*comic.info.count));

	if(comic.info.volume != NULL)
		volumeEdit->setText(*comic.info.volume);
	if(comic.info.storyArc != NULL)
		storyArcEdit->setText(*comic.info.storyArc);
	if(comic.info.arcNumber != NULL)
		arcNumberEdit->setText(QString::number(*comic.info.arcNumber));
	if(comic.info.arcCount != NULL)
		arcCountEdit->setText(QString::number(*comic.info.arcCount));

	if(comic.info.genere != NULL)
		genereEdit->setText(*comic.info.genere);

	if(comic.info.writer != NULL)
		writer->setPlainText(*comic.info.writer);
	if(comic.info.penciller != NULL)
		penciller->setPlainText(*comic.info.penciller);
	if(comic.info.inker != NULL)
		inker->setPlainText(*comic.info.inker);
	if(comic.info.colorist != NULL)
		colorist->setPlainText(*comic.info.colorist);
	if(comic.info.letterer != NULL)
		letterer->setPlainText(*comic.info.letterer);
	if(comic.info.coverArtist != NULL)
		coverArtist->setPlainText(*comic.info.coverArtist);

	size->setText(QString::number(comic.info.hash.right(comic.info.hash.length()-40).toInt()/1024.0/1024.0,'f',2)+"Mb");

	if(comic.info.date != NULL)
	{
		QStringList date = (*comic.info.date).split("/");
		dayEdit->setText(date[0]);
		monthEdit->setText(date[1]);
		yearEdit->setText(date[2]);
	}
	if(comic.info.publisher != NULL)
		publisherEdit->setText(*comic.info.publisher);
	if(comic.info.format != NULL)
		formatEdit->setText(*comic.info.format);
	if(comic.info.color != NULL)
		colorCheck->setChecked(*comic.info.color);
	else
		colorCheck->setCheckState(Qt::PartiallyChecked);

	if(comic.info.ageRating != NULL)
		ageRatingEdit->setText(*comic.info.ageRating);

	if(comic.info.synopsis != NULL)
		synopsis->setPlainText(*comic.info.synopsis);
	if(comic.info.characters != NULL)
		characters->setPlainText(*comic.info.characters);
	if(comic.info.notes != NULL)
		notes->setPlainText(*comic.info.notes);


	if(comics.length() > 1)
	{
		coverBox->hide();

		setDisableUniqueValues(true);
		this->setWindowTitle(tr("Edit selected comics information"));
		setMultipleCover();

		QList<ComicDB>::iterator itr;
		for(itr = ++comics.begin();itr!=comics.end();itr++)
		{
			if(itr->info.title == NULL || *(itr->info.title) != title->text())
				title->clear();
			
			if(itr->info.count == NULL || *(itr->info.count) != countEdit->text().toInt())
				countEdit->clear();

			if(itr->info.volume == NULL || *(itr->info.volume) != volumeEdit->text())
				volumeEdit->clear();
			if(itr->info.storyArc == NULL || *(itr->info.storyArc) != storyArcEdit->text())
				storyArcEdit->clear();
			if(itr->info.arcCount == NULL || *(itr->info.arcCount) != storyArcEdit->text().toInt())
				arcCountEdit->clear();

			if(itr->info.genere == NULL || *(itr->info.genere) != genereEdit->text())
				genereEdit->clear();

			if(itr->info.writer == NULL || *(itr->info.writer) != writer->toPlainText())
				writer->clear();
			if(itr->info.penciller == NULL || *(itr->info.penciller) != penciller->toPlainText())
				penciller->clear();
			if(itr->info.inker == NULL || *(itr->info.inker) != inker->toPlainText())
				inker->clear();
			if(itr->info.colorist == NULL || *(itr->info.colorist) != colorist->toPlainText())
				colorist->clear();
			if(itr->info.letterer == NULL || *(itr->info.letterer) != letterer->toPlainText())
				letterer->clear();
			if(itr->info.coverArtist == NULL || *(itr->info.coverArtist) != coverArtist->toPlainText())
				coverArtist->clear();

			if(itr->info.date == NULL)
			{
				dayEdit->clear();
				monthEdit->clear();
				yearEdit->clear();
			}
			else
			{
				QStringList date = itr->info.date->split("/");
				if(dayEdit->text() != date[0])
					dayEdit->clear();
				if(monthEdit->text() != date[1])
					monthEdit->clear();
				if(yearEdit->text() != date[2])
					yearEdit->clear();
			}

			if(itr->info.publisher == NULL || *(itr->info.publisher) != publisherEdit->text())
				publisherEdit->clear();
			if(itr->info.format == NULL || *(itr->info.format) != formatEdit->text())
				formatEdit->clear();
			if(itr->info.color == NULL || *(itr->info.color) != colorCheck->isChecked())
				colorCheck->setCheckState(Qt::PartiallyChecked);
			if(itr->info.ageRating == NULL || *(itr->info.ageRating) != ageRatingEdit->text())
				ageRatingEdit->clear();

			if(itr->info.synopsis == NULL || *(itr->info.synopsis) != synopsis->toPlainText())
				synopsis->clear();
			if(itr->info.characters == NULL || *(itr->info.characters) != characters->toPlainText())
				characters->clear();
			if(itr->info.notes == NULL || *(itr->info.notes) != notes->toPlainText())
				notes->clear();
		}
	}
	else
	{
		this->setWindowTitle(tr("Edit comic information"));
		setCover(comic.info.getCover(basePath));
	}

}