예제 #1
0
//**********************************************************************************************************************
vector<string> CooccurrenceCommand::setParameters() {	
	try { 
		CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none","summary",false,true,true); parameters.push_back(pshared);		
		CommandParameter pmetric("metric", "Multiple", "cscore-checker-combo-vratio", "cscore", "", "", "","",false,false); parameters.push_back(pmetric);
		CommandParameter pmatrix("matrixmodel", "Multiple", "sim1-sim2-sim3-sim4-sim5-sim6-sim7-sim8-sim9", "sim2", "", "", "","",false,false); parameters.push_back(pmatrix);
        CommandParameter pruns("iters", "Number", "", "1000", "", "", "","",false,false); parameters.push_back(pruns);
		CommandParameter pseed("seed", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pseed);
        CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
		CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
		CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
        CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);

		vector<string> myArray;
		for (int i = 0; i < parameters.size(); i++) {	myArray.push_back(parameters[i].name);		}
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "CooccurrenceCommand", "setParameters");
		exit(1);
	}
}
예제 #2
0
파일: turgraph.c 프로젝트: clamiax/misc
int main(void)
{
   double floor[SIZE][SIZE] = { {0} };

   /* NOTE: don't use (for example) "5.9" but "5.09" and the 
    * 5.01 command do nothing: it write in the current position
    * which has been already written bye the previous command. */

   /* Don't forget '2' to write and '1', '6' and '9' to end */

   double cmds[CMD] = { 2, 5.25, 3, 5.12, 3, 5.25, 3, 5.12, 1, 6, 9 };

   /* Square (CMD = 11)
   double cmds[CMD] = { 2, 5.12, 3, 5.12, 3, 5.12, 3, 5.12, 1, 6, 9 };
   */

   /* C (CMD = 11)
   double cmds[CMD] = { 3, 3, 2, 5.09, 4, 5.06, 4, 5.09, 1, 6, 9 };
   */
   /* H (CMD = 16)
   double cmds[CMD] = {
      3, 2, 5.09, 4, 4, 5.05, 3, 5.08, 4, 5.05, 3, 3, 5.09, 1, 6, 9
   };
   */

   int pen = 0; /* 0 don't write */
   int route = 4, i, j;

   int r = 0, c = 0; /* rows and cols */
   r = c = SIZE/2-1; /* Logo start from middle of floor */

   /* loop all commands (cmds[]) */
   for(i = 0; i < CMD; i++) {
      /* check the command */
      switch( (int)cmds[i] ) {
	 case 1:
	    pen = 0;
	    break;
	 case 2:
	    pen = 1;
	    break;
	 case 3:
	 case 4:
	    route = getroute(route, (int)cmds[i]);
	    break;
         case 5:
	    j = (int)(cmds[i] * 100) % 100;

	    if(cmds[i] == 5.02 || cmds[i] == 5.06) /* fix 5.02 and 5.06 */
	       ++j;

	    /* Overflow check */
	    if( (route == 1 && r + j > SIZE) || (route == 2 && r - j < 0) ||
		(route == 3 && c - j < 0) || (route == 4 && c + j > SIZE)
  	    ) {
		printf("You can't go out of floor (%dx%d): 5.%d\n",
		SIZE, SIZE, j);
		return -1;
            }

	    for( ; j ; j--) {
               /* UP[1], DOWN[2], LEFT[3], RIGHT[4] */

               if(route > 2)
	          floor[r][route == 4 ? c++ : c--] = pen;
	       else
	          floor[route == 2 ? r-- : r++][c] = pen;

	    } /* end for (j) */

	    /* cursor in the current position */
	    if(route == 4) c--;
	    else if(route == 3) ++c;
	    else if(route == 2) ++r;
	    else --r;

	    break;
         case 6:
	    /* print the matrix */
	    pmatrix(floor, SIZE);
	    break; /* not required */
      } /* end switch (cmds[i]) */

   } /* end for (i) */
   printf("\n");

   return 0;
} /* E0F main */