void CDeveloperListDataManager::sort(int column, Qt::SortOrder order/* = Qt::AscendingOrder*/)
{
  switch( column )
  {
    case COLNUM_NAME:
    {
      SortData( [order](const CDeveloperData &f, const CDeveloperData &s)->bool
      {
        if( order == Qt::AscendingOrder )
          return f.getName() < s.getName();

        if( order == Qt::DescendingOrder )
          return f.getName() > s.getName();

        return false;
      });
    }
    break;

    case COLNUM_WR:
    {
      SortData( [order](const CDeveloperData &f, const CDeveloperData &s)->bool
      {
        if( order == Qt::AscendingOrder )
          return f.getWageRate() < s.getWageRate();

        if( order == Qt::DescendingOrder )
          return f.getWageRate() > s.getWageRate();

        return false;
      });
    }
    break;
  }
}
Пример #2
0
////////////////////////////////////////
//// Metadata
////////////////////////////////////////
VideoMetadata::SortKey VideoMetadata::GenerateDefaultSortKey(const VideoMetadata &m,
                                                   bool ignore_case)
{
    QString title(ignore_case ? m.GetTitle().toLower() : m.GetTitle());
    title = TrimTitle(title, ignore_case);

    return SortKey(SortData(title, m.GetFilename(),
                         QString().sprintf("%.7d", m.GetID())));
}
Пример #3
0
SortTable:: SortTable(const ScanTable& table)
{
	size = table.size;
	pos = 0;
	count = table.count;
	recs = new TabRecord*[size];
	for (int i=0; i<count; i++)
		recs[i] = new TabRecord(table.recs[i]->GetKey(), table.recs[i]->GetData());
	SortData();
}
Пример #4
0
void OptimiseData::Run(csString in, csString out)
{
  printf("Collecting Data!\n");
  CollectData(in);

  printf("Sorting Data!\n");
  SortData();

  printf("Writing Data!\n");
  WriteData(out);
}
Пример #5
0
// Exec_SortEnsembleData::Execute()
Exec::RetType Exec_SortEnsembleData::Execute(CpptrajState& State, ArgList& argIn)
{
  debug_ = State.Debug();
  DataSetList setsToSort;
  std::string dsarg = argIn.GetStringNext();
  while (!dsarg.empty()) {
    setsToSort += State.DSL().GetMultipleSets( dsarg );
    dsarg = argIn.GetStringNext();
  }

  int err = 0;
# ifdef MPI
  // For now, require ensemble mode in parallel.
  if (!Parallel::EnsembleIsSetup()) {
    rprinterr("Error: Data set ensemble sort requires ensemble mode in parallel.\n");
    return CpptrajState::ERR;
  }
  // Only TrajComm masters have complete data.
  if (Parallel::TrajComm().Master()) {
    comm_ = Parallel::MasterComm();
# endif
    DataSetList OutputSets;
    err = SortData( setsToSort, OutputSets );
    if (err == 0) {
      // Remove unsorted sets. 
      for (DataSetList::const_iterator ds = setsToSort.begin(); ds != setsToSort.end(); ++ds)
        State.DSL().RemoveSet( *ds );
      // Add sorted sets.
      for (DataSetList::const_iterator ds = OutputSets.begin(); ds != OutputSets.end(); ++ds)
        State.DSL().AddSet( *ds );
      // Since sorted sets have been transferred to master DSL, OutputSets now
      // just has copies.
      OutputSets.SetHasCopies( true );
      mprintf("\tSorted sets:\n");
      OutputSets.List();
    }
# ifdef MPI
  }
  if (Parallel::World().CheckError( err ))
# else
  if (err != 0) 
# endif
    return CpptrajState::ERR;
  return CpptrajState::OK;
}
Пример #6
0
Файл: hw07.c Проект: 0lumide/cs
int main()
{
  //LOCAL DECLARATION
  int input[SIZE] = {0};//This is an array of 25 that holds the users input
  int output[SIZE] = {0};//This is an array of 25 that holds the nearly sorted data
  int set_size; //This is the variable that holds the amount of input entered by the user
  int i; //for loop control variable

  //EXECUTABLE STATEMENT
  set_size = getInput(input);

  for (i = 0; i < set_size; i++)
  {
    output[i] = input[i];
  }

  SortData(output, set_size);
  PrintOut(input, output, set_size);

  return(0);
}