コード例 #1
0
ファイル: datarange.cpp プロジェクト: KDE/kst-plot
void DataRange::loadWidgetDefaults() {
  setRange(dialogDefaults().value("vector/range", 1).toInt());
  setStart(dialogDefaults().value("vector/start", 0).toInt());
  setCountFromEnd(dialogDefaults().value("vector/countFromEnd",false).toBool());
  setReadToEnd(dialogDefaults().value("vector/readToEnd",true).toBool());
  setSkip(dialogDefaults().value("vector/skip", 0).toInt());
  setDoSkip(dialogDefaults().value("vector/doSkip", false).toBool());
  setDoFilter(dialogDefaults().value("vector/doAve",false).toBool());
  setRangeUnits(dialogDefaults().value("vector/rangeUnits",tr("frames")).toString());
  setStartUnits(dialogDefaults().value("vector/startUnits",tr("frames")).toString());
}
コード例 #2
0
ファイル: build.c プロジェクト: verdurin/gimmemotifs
// Calculate skip for the suffix array
int calcSkip(ESA esa)
{
  int size = esa->size;
  int *latest = malloc(sizeof(*latest) * (MAXPSSMSIZE+1));
  if(latest == NULL)
  {
  	setError("Couldn't allocate temporary memory for skip calculation.");
  	return 0;
  }
  int i, j, minS, curLcp;
  
  // latest points to a table of where we last encountered the various possible
  // lcp values - we start by initializing it to -1 (means we never encountered
  // any of the lcp's)
  for(i = 0; i < MAXPSSMSIZE+1; i++)
    latest[i] = -1;
  
  // Last suffix has skip = size
  curLcp = getLcp(esa, size-1);
  latest[curLcp] = size-1;
  setSkip(esa, size-1,size);
  
  // Start from the second-last row and calculate skip's upwards  
  for(i = size - 2; i >= 0; i--){
    // Get lcp for this row
    curLcp = getLcp(esa, i);
    
    // Register it in table
    latest[curLcp] = i;
    
    // Find the row with the lowest index that is greater than ours and that has a 
    // strictly lower lcp 
    minS = -1;
    for(j = curLcp - 1; j >= 0; j--){			
       if(minS == -1) {
  	      minS = latest[j];
       }
       else {
  	      break;
       }
    }
 
    // then the smallest skip value is found
    for(; j >= 0; j--) {
       if(minS > latest[j]&&(latest[j]> -1)){
	      minS = latest[j];
       }
    }
    
    // If a value was found this value is registrered
    if(minS != -1) {
       setSkip(esa, i, minS);			
    } 
    // Else skip is set to the size of the text
    else {
       setSkip(esa, i, size);			
    }
  }
  free(latest);
  return 1;
}