void HelloWorld::MoveScoreAdd(float dt)  
{  

	addBestScore();
	//addSilver();
	if (testnum>=15)
	{
		addGold();
	}
	else if (testnum>=10)
	{
		addSilver();
	}
	if(m_bnew)
	{
		addNew();
	}
	if (testnum>=10)
	{
		m_emitter = CCParticleFlower::createWithTotalParticles(10);
		m_emitter->retain();
		m_pScore->addChild(m_emitter);
		m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage("stars.png") );
		m_emitter->setPosition(ccp(49/mfac,51/mfac));
	}
}
Пример #2
0
AggregateRowBuilder &RowAggregator::addRow(const void * row)
{
    AggregateRowBuilder *result;
    unsigned hash = hasher->hash(row);
    void * match = find(hash, row);
    if (match)
    {
        result = static_cast<AggregateRowBuilder *>(match);
        totalSize -= result->querySize();
        size32_t sz = helper.processNext(*result, row);
        result->setSize(sz);
        totalSize += sz;
    }
    else
    {
        Owned<AggregateRowBuilder> rowBuilder = new AggregateRowBuilder(rowAllocator, hash);
        helper.clearAggregate(*rowBuilder);
        size32_t sz = helper.processFirst(*rowBuilder, row);
        rowBuilder->setSize(sz);
        result = rowBuilder.getClear();
        addNew(result, hash);
        totalSize += sz;
        overhead += ROWAGG_PERROWOVERHEAD;
    }
    return *result;
}
Пример #3
0
void Interface::menu(int& userChoice)//displays the initial menu for user
{
    cout << "Choose a number from the menu" << endl;
    cout << "-----------------------------" << endl;
    cout << "1 to add new item to database" << endl;
    cout << "2 to display all info" << endl;
    cout << "3 to arrange list" << endl;
    cout << "4 to search for a name" << endl;
    cout << "5 to quit the program" << endl;

    cin >> userChoice;
    switch (userChoice) {
    case 1:
        addNew();
        break;
    case 2:
        displayList();
        break;
    case 3:
        selectOrder();
        break;
    case 4:
        search();
        break;
    case 5:
        break;
    default:
        cout << "Wrong input";
        break;
    }
}
Пример #4
0
bool MinimalHistoryEditor::save(const Call* call)
{
   if (call->collection()->editor<Call>() != this)
      return addNew(call);

   return regenFile(nullptr);
}
Пример #5
0
int main(){

	int optionNum;
	while (1) {
	mainUI();
	scanf("%d",&optionNum);
	if(optionNum==0){
		break;

	}else if(optionNum==1){
		addNew();

	}else if(optionNum==2){
		showOneRec();

	}else if(optionNum==3){
		showAllRec();

	}else if(optionNum==4){
        deteteEntry();
	}

	}

return 0;
}
// Вставка записей из буфера обмена
void RecordTableController::paste(void)
{
// Проверяется, содержит ли буфер обмена данные нужного формата
    const QMimeData *mimeData=QApplication::clipboard()->mimeData();
    if(mimeData==NULL)
        return;
    if( ! (mimeData->hasFormat("mytetra/records")) )
        return;

// Создается ссылка на буфер обмена
    QClipboard *clipboardBuf=QApplication::clipboard();

// Извлечение объекта из буфера обмена
// const clipboardrecords *rcd=new clipboardrecords();
    const ClipboardRecords *clipboardRecords;
    clipboardRecords=qobject_cast<const ClipboardRecords *>(clipboardBuf->mimeData());
    clipboardRecords->print();

// Выясняется количество записей в буфере
    int nList=clipboardRecords->getCount();

// Пробегаются все записи в буфере
    for(int i=0; i<nList; i++)
        addNew(ADD_NEW_RECORD_TO_END, clipboardRecords->getRecord(i));

// Обновление на экране ветки, на которой стоит засветка,
// так как количество хранимых в ветке записей поменялось
    find_object<TreeScreen>("treeScreen")->updateSelectedBranch();
}
Пример #7
0
void Graph::sg_CCC()
{
  if(dbg) Rprintf("Class Cover Catch: ");

  double m=MAX_DOUBLE, mm = -MAX_DOUBLE;
  std::vector<double> mass(pp->size());
  int i,j;
  int type0=1; // target type set to 1. Re-arrange in R to change.

  for(i=0; i<pp->size();i++)
  {
    mass.at(i)=mm;
    if(par[i]==type0)
    {
      mass.at(i) = m;
      for(j=0;j<pp->size();j++)
        if( (j!=i) & (par[j]!=type0) )
        {
          mass.at(i) = fmin(mass.at(i), pp->getDist(&i, &j));
        }
    }
  }
  for(i=0;i<pp->size();i++) //TODO: optimize this
    if(par[i]==type0)
      for(j=0;j<pp->size();j++)
        if(i!=j)
          if(par[j]==type0)
            if(pp->getDist(&i, &j)< mass.at(i))
              addNew(i,j+1);

  if(dbg) Rprintf(" Ok.");
}
Пример #8
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
    _ui.setupUi(this);

    connect(_ui.actionNew, SIGNAL(triggered()), this, SLOT(addNew()));
    connect(_ui.actionExit, SIGNAL(triggered()), this, SLOT(exitApp()));
    connect(_ui.actionView_wireframe, SIGNAL(triggered(bool)), _ui.tabPane, SLOT(enableWireFrameView(bool)));
    connect(_ui.actionLighting, SIGNAL(triggered(bool)), _ui.tabPane, SLOT(enableLighting(bool)));
    connect(_ui.actionToggleTexturing, SIGNAL(triggered(bool)), _ui.tabPane, SLOT(enableTexturing(bool)));
}
Пример #9
0
void ResourceDock::addNewAct() {
	auto pitem = resTree->currentItem();
	auto restype = Kite::getRTypesByName(pitem->text(0).toStdString());
	
	// is it type?
	if (pitem->parent() == nullptr) {
		addNew(restype, "", true);
	}
}
Пример #10
0
SubListWidget::SubListWidget(QList<PubSubInfo>& subs, QWidget* parentObj)
  : Base(parentObj),
    m_subs(subs)
{
    m_ui.setupUi(this);

    for (auto& sub : m_subs) {
        addElemWidget(sub);
    }

    connect(
        m_ui.m_addPushButton, SIGNAL(clicked()),
        this, SLOT(addNew()));
}
Пример #11
0
void Graph::sg_RNG()
{
  if(dbg) Rprintf("Relative neighbourhood: ");
  int i,j,k,isempty;
  for(i = 0; i < pp->size()-1; i++)
  {
    for(j = i+1; j < pp->size(); j++)
    {
      isempty = 1;
      for(k=0; k < pp->size(); k++)
        if( (k!=i) & (k!=j) )
          if(pp->getDist(&i,&k) < pp->getDist(&i, &j))
            if(pp->getDist(&j,&k) < pp->getDist(&j,&i))
            {isempty=0;break;}
            if(isempty)
            {
              addNew(i,j+1);
              addNew(j,i+1);
            }
    }
  }
  if(dbg) Rprintf(" Ok.");
}
Пример #12
0
NewStreamView::NewStreamView() :
mStreams(SettingsManager::getSettingsManager()->getStreams())
{
    setupUi(this);
    nameLineEdit->setDisabled(true);
    urlLineEdit->setDisabled(true);
    setWindowTitle("Add new stream");
    for (auto it(mStreams.begin()); it != mStreams.end(); ++it)
    {
        listWidget->addItem (it->first);
    }
    connect(newButton, SIGNAL(clicked()), this, SLOT(addNew()));
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteCurrent()));
    connect(mStoreButton, SIGNAL(clicked()), this, SLOT(storeStreams()));
    connect(nameLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(storeName(const QString &)));
    connect(urlLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(storeUrl(const QString &)));
    connect(listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateEdits()));
}
Пример #13
0
void RowAggregator::mergeElement(const void * otherElement)
{
    unsigned hash = elementHasher->hash(otherElement);
    void * match = findElement(hash, otherElement);
    if (match)
    {
        AggregateRowBuilder *rowBuilder = static_cast<AggregateRowBuilder *>(match);
        totalSize -= rowBuilder->querySize();
        size32_t sz = helper.mergeAggregate(*rowBuilder, otherElement);
        rowBuilder->setSize(sz);
        totalSize += sz;
    }
    else
    {
        Owned<AggregateRowBuilder> rowBuilder = new AggregateRowBuilder(rowAllocator, hash);
        rowBuilder->setSize(cloneRow(*rowBuilder, otherElement, rowAllocator->queryOutputMeta()));
        addNew(rowBuilder.getClear(), hash);
    }
}
Пример #14
0
void Graph::sg_RST()
{
  int k;
  int dim = pp->d();
  if(dbg){
    Rprintf("Radial Spanning Tree (o=( ");
    for(k=0; k < dim;k++) Rprintf("%f ", par[k]);
    Rprintf(")):");
  }

  edges.resize(pp->size());
  int i,j,m;
  double apu0,apu1,apu2,apu3;

  for(i=0;i< pp->size(); i++)
  {
    apu0 = 0;
    for(m=0; m <dim ; m++) apu0+=pow(pp->getCoord(&i, &m) - par[m], 2);
    apu0 = sqrt(apu0);
    apu3=MAX_DOUBLE;
    k=-1;
    for(j=0; j < pp->size(); j++)
    {
      if(j!=i)
      {
        apu1 = 0;
        for(m=0; m < dim ; m++) apu1+=pow(pp->getCoord(&j, &m) - par[m], 2);
        apu1 = sqrt(apu1);
        if(apu1 < apu0 )
        {
          apu2 = pp->getDist(&i, &j);
          if( apu2 < apu3 )
          {
            apu3 = apu2;
            k = j;
          }
        }
      }
    }
    if(k>-1) addNew(k, i+1);
  }
  if(dbg) Rprintf(" Ok.");
}
Пример #15
0
 // WILL PROBABLY HAVE TONS OF POINTER ISSUES HERE
list_elt *update (list_elt *first_elt, char *name, int count) {
	list_elt *elt = lookup(first_elt, name); // don't know if pointers will work in this case(?)
	
	// If element is already in the list, update value
	if (elt != NULL) {
		elt->number = elt->number + count;
		// Delete from list if count reaches 0
		if (elt->number <= 0) {
			return delete(first_elt, elt);
		}
	}
	else {
		// Only add element if count is greater than zero
		if (count > 0){
			return addNew(first_elt, name, count);
		}
	}
	return first_elt;
}
Пример #16
0
void menuType::process(mappingType & map)
{
  cout << "--Processing Data" << endl;
  int status = 0;  //Default fail status


  //Debugging
    int number;      //Number for input
  switch (choice)
  {
    case 1:  //Add a new number
      cout << "Add New Number" << endl;

      status = addNew(map);
      if(status) 
        cout << "Item Added Successfully" << endl;
      break;
    case 2:  //Displays all numbers
      cout << "Display all numbers" << endl << endl;
      status = map.dispAll();
      if (!status)
        cout << "List is empty!" << endl;
      break;
    case 3:  //Remove a number
      cout << "Remove a number" << endl;
      status = map.deleteItem(2);
      if(!status)
        cout << "Successful Deletion" << endl;
      else if (status == 1)
        cout << "There are no items with id's below 0." << endl;
      else if (status == 2)
        cout << "There are no id's with that high of a number" << endl;
      break;

    case 6:  //Exit program
      cout << "Exiting program" << endl << endl;
      break;
    default: //Default
      cout << "That is not a valid choice. Please try again" << endl;
      break;
  }
}
    void TrackingBruteForce::process(FrameList &frames) {
        if(frames.hasPrevious())
        {
            for(int n = 0; n < frames.getCurrent().getCameras().size(); n++)
            {
                CameraObject & cameraCurr = frames.getCurrent().getCameras()[n];
                CameraObject & cameraPrev = frames.getPrevious().getCameras()[n];

                // Containers that will be reduced in size when manipulated below
                std::list<Object> prevPotentialObjects(cameraPrev.getPotentialObjects().begin(), cameraPrev.getPotentialObjects().end());
                std::list<Object> prevObjects(cameraPrev.getObjects().begin(), cameraPrev.getObjects().end());
                std::list<Object> currCandidates(cameraCurr.getObjects().begin(), cameraCurr.getObjects().end());
                cameraCurr.getObjects().clear();

                // 0) Check if the objects are inside any of the marker masks, set flags.
                if(frames.hasCheckPointMasks()){
                setIfIsInCheckpointRegion(currCandidates,frames.getCheckPointMaskSmall(),frames.getCheckPointMaskMedium(),frames.getCheckPointMaskLarge());
                }
                // The purpose here is to fill cameraCurr.objects with new or old actual objects
                // and cameraCurr.potentialObjects with candidates that may be considered objects in the future

                // 1) Previous objects are paired with current candidate objects and moved to current object list.
                pairAndPopulate(prevObjects, currCandidates, cameraCurr.getObjects());

                // 2) Previous potential objects are paired with the remaining current candidate objects
                //    and moved to current potential object list.
                pairAndPopulate(prevPotentialObjects, currCandidates, cameraCurr.getPotentialObjects());

                // 3) Any remaining current candidate list is added as (new) current potential object.
                addNew(currCandidates, cameraCurr.getPotentialObjects());

                // 4) Any remaining previous objects are flagged as lost and added to current objects.
                addLost(prevObjects, cameraCurr.getObjects(), cameraCurr.getTransitionaryObjects(), cameraCurr.getImage("rawImage"),frames.getDoorMask());

                // 5) Elevate pervious candidate objects to real objects if they have lived long enough.
                elevatePotentialObjects(cameraCurr.getPotentialObjects(), cameraCurr.getObjects(),cameraCurr.getNewlyFoundObjects());

                //Write info on debugImage
                writeToDebugImage(cameraCurr);
            }
        }
    }
// Вызов окна добавления данных в таблицу конечных записей
void RecordTableController::addNewRecord(int mode)
{
    qDebug() << "In add_new_record()";

// Создается окно ввода данных
// При клике Ok внутри этого окна, будет создана временная директория
// с картинками, содержащимися в тексте
    AddNewRecord addNewRecordWin;
    int i=addNewRecordWin.exec();
    if(i==QDialog::Rejected)
        return; // Была нажата отмена, ничего ненужно делать

// Имя директории, в которой расположены файлы картинок, используемые в тексте и приаттаченные файлы
    QString directory=addNewRecordWin.getImagesDirectory();

// todo: сделать заполнение таблицы приаттаченных файлов

    Record record;
    record.switchToFat();
    record.setText( addNewRecordWin.getField("text") );
    record.setField("name",   addNewRecordWin.getField("name"));
    record.setField("author", addNewRecordWin.getField("author"));
    record.setField("url",    addNewRecordWin.getField("url"));
    record.setField("tags",   addNewRecordWin.getField("tags"));
    record.setPictureFiles( DiskHelper::getFilesFromDirectory(directory, "*.png") );

// Пока что принята концепция, что файлы нельзя приаттачить в момент создания записи
// Запись должна быть создана, потом можно аттачить файлы.
// Это ограничение для "ленивого" программинга, но пока так
// record.setAttachFiles( DiskHelper::getFilesFromDirectory(directory, "*.bin") );

// Временная директория с картинками и приаттаченными файлами удаляется
    DiskHelper::removeDirectory(directory);

// Введенные данные добавляются (все только что введенные данные передаются в функцию addNew() незашифрованными)
    addNew(mode, record);
}
Пример #19
0
TierWindow::TierWindow(QWidget *parent) : QWidget(parent), helper(NULL)
{
    setAttribute(Qt::WA_DeleteOnClose,true);

    QGridLayout *layout = new QGridLayout(this);

    dataTree = TierMachine::obj()->getDataTree();

    m_tree = new QTreeWidget();
    layout->addWidget(m_tree, 0, 0, 2, 1);
    m_tree->header()->hide();
    m_tree->setFixedWidth(200);

    configWidget = new QWidget();
    layout->addWidget(configWidget, 0, 1, 1, 2);
    QVBoxLayout *v = new QVBoxLayout(configWidget);
    internalWidget = new QWidget();
    v->addWidget(internalWidget);

    QPushButton *add, *finish;
    add = new QPushButton("Add New...");

    finish = new QPushButton("Finish and Apply");

    layout->addWidget(add,1,1);
    layout->addWidget(finish,1,2);
    layout->setColumnStretch(1, 50);
    layout->setColumnStretch(2, 50);

    updateTree();

    connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(editingRequested(QTreeWidgetItem*)));
    connect(add, SIGNAL(clicked()), SLOT(addNew()));
    connect(finish, SIGNAL(clicked()), SLOT(done()));
    connect(finish, SIGNAL(clicked()), SLOT(close()));
}
Пример #20
0
void strassen(my_type **A, my_type **B, my_type **C, size_t size) {
    if (size == FIXEDSIZE) {
        matrixMultiplicationTiled(A, B, C, size);
        return;
    }
    // if (size == FIXEDSIZE) {
    //   matrixMultiplicationFixed(A, B, C);
    //   return;
    // }
    // if (size == FIXEDSIZE) {
    //   asmMul(*A, *B, *C);
    //   return;
    // }
    // if (size == FIXEDSIZE) {
    //   asmMul32(*A, *B, *C);
    //   return;
    // }
    size_t mid = size / 2;
    my_type **A11 = getArray(mid);
    my_type **A12 = getArray(mid);
    my_type **A21 = getArray(mid);
    my_type **A22 = getArray(mid);
    my_type **B11 = getArray(mid);
    my_type **B12 = getArray(mid);
    my_type **B21 = getArray(mid);
    my_type **B22 = getArray(mid);

    for (size_t i = 0; i < mid; i++) {
        for (size_t j = 0; j < mid; j++) {
            A11[i][j] = A[i][j];
            A12[i][j] = A[i][j + mid];
            A21[i][j] = A[i + mid][j];
            A22[i][j] = A[i + mid][j + mid];
            B11[i][j] = B[i][j];
            B12[i][j] = B[i][j + mid];
            B21[i][j] = B[i + mid][j];
            B22[i][j] = B[i + mid][j + mid];
        }
    }

    my_type **S1 = getArray(mid);
    my_type **S2 = getArray(mid);

    addNew(*A21, *A22, *S1, mid);
    subNew(*S1, *A11, *S2, mid);

    subRight(*A11, *A21, mid);
    my_type **S3 = A21;

    my_type **P1 = getArray(mid);
    strassen(A11, B11, P1, mid);
    my_type **T1 = A11;
    subNew(*B12, *B11, *T1, mid);

    my_type **T2 = getArray(mid);
    subNew(*B22, *T1, *T2, mid);

    subRight(*B22, *B12, mid);
    my_type **T3 = B12;

    my_type **S4 = getArray(mid);
    my_type **T4 = getArray(mid);
    subNew(*A12, *S2, *S4, mid);
    subNew(*T2, *B21, *T4, mid);

    strassen(A12, B21, B11, mid);
    my_type **P2 = B11;
    strassen(S4, B22, B21, mid);
    my_type **P3 = B21;
    strassen(A22, T4, A12, mid);
    free(A22[0]);
    free(A22);
    my_type **P4 = A12;
    strassen(S1, T1, S4, mid);
    free(T1[0]);
    free(T1);
    free(S1[0]);
    free(S1);
    my_type **P5 = S4;
    strassen(S2, T2, B22, mid);
    free(S2[0]);
    free(S2);
    free(T2[0]);
    free(T2);
    my_type **P6 = B22;
    strassen(S3, T3, T4, mid);
    my_type **P7 = T4;
    free(S3[0]);
    free(S3);
    free(T3[0]);
    free(T3);

    // A22, T1, S1, S2, T2, S3, T3,
    // P6, P3
    addLeft(*P2, *P1, mid);
    my_type **U1 = P2;
    addLeft(*P1, *P6, mid);
    free(P6[0]);
    free(P6);
    my_type **U2 = P1;
    addLeft(*P7, *U2, mid);
    my_type **U3 = P7;
    addLeft(*U2, *P5, mid);
    my_type **U4 = U2;
    addLeft(*U4, *P3, mid);
    free(P3[0]);
    free(P3);
    my_type **U5 = U4;
    subRight(*U3, *P4, mid);
    my_type **U6 = P4;
    addLeft(*U3, *P5, mid);
    my_type **U7 = U3;
    free(P5[0]);
    free(P5);

    for (size_t i = 0; i < mid; i++) {
        for (size_t j = 0; j < mid; j++) {
            C[i][j] = U1[i][j];
            C[i][j + mid] = U5[i][j];
            C[i + mid][j] = U6[i][j];
            C[i + mid][j + mid] = U7[i][j];
        }
    }
    free(U1[0]);
    free(U1);
    free(U5[0]);
    free(U5);
    free(U6[0]);
    free(U6);
    free(U7[0]);
    free(U7);

    return;
}
Пример #21
0
void strassenQuad(Quad *A, Quad *B, Quad *C, size_t size) {
    // if (size == FIXEDSIZE) {
    //   matrixMultiplicationTiled(A, B, C, size);
    //   return;
    // }
    // if (size == FIXEDSIZE) {
    //   matrixMultiplicationFixed(A, B, C);
    //   return;
    // }
    if (size == FIXEDSIZE) {
#if DATATYPE == 0
#if FIXEDSIZE == 32
        asmMul32(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 64
        // printf("64\n");
        asmMul(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 128
        // printf("128\n");
        asmMul128(A->matrix, B->matrix, C->matrix);
#endif

#elif DATATYPE == 1
#if FIXEDSIZE == 64
        asmMulF64(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 128
        asmMulF128(A->matrix, B->matrix, C->matrix);
#elif FIXEDSIZE == 256
        asmMulF256(A->matrix, B->matrix, C->matrix);
#endif
#endif //datatype == 0
        return;
    }
    // if (size == FIXEDSIZE) {
    //   return;
    // }
    size_t mid = size / 2;
    Quad *A11 = A->children[0];
    Quad *A12 = A->children[1];
    Quad *A21 = A->children[2];
    Quad *A22 = A->children[3];
    Quad *B11 = B->children[0];
    Quad *B12 = B->children[1];
    Quad *B21 = B->children[2];
    Quad *B22 = B->children[3];

    Quad *T3 = C->children[0];
    subNew(B22->matrix, B12->matrix, T3->matrix, mid);

    Quad *S3 = C->children[1];
    subNew(A11->matrix, A21->matrix, S3->matrix, mid);

    Quad *P7 = C->children[3];
    strassenQuad(S3, T3, P7, mid);

    Quad *T1 = newQuad(mid);
    subNew(B12->matrix, B11->matrix, T1->matrix, mid);

    Quad *S1 = newQuad(mid);
    addNew(A21->matrix, A22->matrix, S1->matrix, mid);

    Quad *P5 = C->children[0];
    strassenQuad(S1, T1, P5, mid);

    subLeft(S1->matrix, A11->matrix, mid);
    Quad *S2 = S1;

    subRight(B22->matrix, T1->matrix, mid);
    Quad *T2 = T1;

    Quad *T4 = C->children[1];
    subNew(T2->matrix, B21->matrix, T4->matrix, mid);

    Quad *P4 = C->children[2];
    strassenQuad(A22, T4, P4, mid);

    strassenQuad(S2, T2, T4, mid);
    Quad *P6 = T4;

    subRight(A12->matrix, S2->matrix, mid);
    Quad *S4 = S2;

    strassenQuad(S4, B22, T2, mid);
    Quad *P3 = T2;

    strassenQuad(A11, B11, S4, mid);
    Quad *P1 = S4;

    addLeft(P6->matrix, P1->matrix, mid);
    Quad *U2 = P6;

    addLeft(P7->matrix, U2->matrix, mid);
    Quad *U3 = P7;

    addLeft(U2->matrix, P5->matrix, mid);
    Quad *U4 = U2;

    subRight(U3->matrix, P4->matrix, mid);
    Quad *U6 = P4;

    addLeft(U3->matrix, P5->matrix, mid);
    Quad *U7 = U3;

    strassenQuad(A12, B21, P5, mid);
    Quad *P2 = P5;

    addLeft(P2->matrix, P1->matrix, mid);
    Quad *U1 = P2;

    addLeft(U4->matrix, P3->matrix, mid);
    Quad *U5 = U4;

    freeQuad(P3);
    freeQuad(P1);

    return;
}
Пример #22
0
void SuperHashTable::addNew(void * donor)
{
    addNew(donor, getHashFromElement(donor));
}
Пример #23
0
void FormModifyWeight::chooseFunc(MtcKeyPressedEvent *mtcKeyEvent)
{
    int nIndex = ui->tableWidget->currentRow();
    if(nIndex < 0)
    {
        nIndex = 0;
    }
    if(mtcKeyEvent->isNumKey())
    {
        mtcKeyEvent->setKeyType(KC_Number);

        int keyNum = mtcKeyEvent->getLogicKeyName().toInt();
        switch(keyNum)
        {
        case 1:
            addNew();
            break;
        case 2:
            modifyOne();
            break;
        case 3:
            deleteOne();
            break;
        case 4:
            split();
            break;
        case 5:
            combine();
            break;
        case 6:
            clearAll();
            break;
        default:
            break;
        }
    }
    if(mtcKeyEvent->isFuncKey())
    {
        switch(mtcKeyEvent->func())
        {
        case KeyConfirm:
            setResult(1);
            break;
        case KeyEsc:
            setResult(0);
            break;
        case KeyUp:
            if(nIndex >= 0)
            {
                ui->tableWidget->selectRow(ui->tableWidget->currentRow() - 1);
            }
            break;
        case KeyDown:
            if(nIndex >= 0)
            {
                ui->tableWidget->selectRow(ui->tableWidget->currentRow() + 1);
            }
            break;
        default:
            break;
        }
    }
}
Пример #24
0
void Programme::addSubElement( QDomElement &element) {
  if(element.localName().compare("Icon", Qt::CaseInsensitive)==0) {
    Icon *cn = Icon::fromElement(element);
    addIcon(cn);
    return;
  }
  if(element.localName().compare("Category", Qt::CaseInsensitive)==0) {
    Category *cn = Category::fromElement(element);
    addCategory(cn);
    return;
  }
  if(element.localName().compare("SubTitle", Qt::CaseInsensitive)==0) {
    SubTitle *cn = SubTitle::fromElement(element);
    addSubTitle(cn);
    return;
  }
  if(element.localName().compare("LastChance", Qt::CaseInsensitive)==0) {
    LastChance *cn = LastChance::fromElement(element);
    addLastChance(cn);
    return;
  }
  if(element.localName().compare("Audio", Qt::CaseInsensitive)==0) {
    Audio *cn = Audio::fromElement(element);
    addAudio(cn);
    return;
  }
  if(element.localName().compare("Subtitles", Qt::CaseInsensitive)==0) {
    Subtitles *cn = Subtitles::fromElement(element);
    addSubtitles(cn);
    return;
  }
  if(element.localName().compare("Date", Qt::CaseInsensitive)==0) {
    Date *cn = Date::fromElement(element);
    addDate(cn);
    return;
  }
  if(element.localName().compare("PreviouslyShown", Qt::CaseInsensitive)==0) {
    PreviouslyShown *cn = PreviouslyShown::fromElement(element);
    addPreviouslyShown(cn);
    return;
  }
  if(element.localName().compare("Country", Qt::CaseInsensitive)==0) {
    Country *cn = Country::fromElement(element);
    addCountry(cn);
    return;
  }
  if(element.localName().compare("OrigLanguage", Qt::CaseInsensitive)==0) {
    OrigLanguage *cn = OrigLanguage::fromElement(element);
    addOrigLanguage(cn);
    return;
  }
  if(element.localName().compare("StarRating", Qt::CaseInsensitive)==0) {
    StarRating *cn = StarRating::fromElement(element);
    addStarRating(cn);
    return;
  }
  if(element.localName().compare("Credits", Qt::CaseInsensitive)==0) {
    Credits *cn = Credits::fromElement(element);
    addCredits(cn);
    return;
  }
  if(element.localName().compare("Title", Qt::CaseInsensitive)==0) {
    Title *cn = Title::fromElement(element);
    addTitle(cn);
    return;
  }
  if(element.localName().compare("Video", Qt::CaseInsensitive)==0) {
    Video *cn = Video::fromElement(element);
    addVideo(cn);
    return;
  }
  if(element.localName().compare("New", Qt::CaseInsensitive)==0) {
    New *cn = New::fromElement(element);
    addNew(cn);
    return;
  }
  if(element.localName().compare("Rating", Qt::CaseInsensitive)==0) {
    Rating *cn = Rating::fromElement(element);
    addRating(cn);
    return;
  }
  if(element.localName().compare("EpisodeNum", Qt::CaseInsensitive)==0) {
    EpisodeNum *cn = EpisodeNum::fromElement(element);
    addEpisodeNum(cn);
    return;
  }
  if(element.localName().compare("Length", Qt::CaseInsensitive)==0) {
    Length *cn = Length::fromElement(element);
    addLength(cn);
    return;
  }
  if(element.localName().compare("Url", Qt::CaseInsensitive)==0) {
    Url *cn = Url::fromElement(element);
    addUrl(cn);
    return;
  }
  if(element.localName().compare("Review", Qt::CaseInsensitive)==0) {
    Review *cn = Review::fromElement(element);
    addReview(cn);
    return;
  }
  if(element.localName().compare("Language", Qt::CaseInsensitive)==0) {
    Language *cn = Language::fromElement(element);
    addLanguage(cn);
    return;
  }
  if(element.localName().compare("Premiere", Qt::CaseInsensitive)==0) {
    Premiere *cn = Premiere::fromElement(element);
    addPremiere(cn);
    return;
  }
  if(element.localName().compare("Desc", Qt::CaseInsensitive)==0) {
    Desc *cn = Desc::fromElement(element);
    addDesc(cn);
    return;
  }
}
Пример #25
0
void initCmds() {
	int lastParams;
	char *lastParamsFlags;
	char *lastExpr;

	addNew  ("help",            "gf.help(\"\")",           0, ""     );
	const char * const *helpPages=stringsGetContent("help");
	do {
		if (!**helpPages)
			continue;
		char cmd[50], expr[50];
		sprintf(cmd, "help %s", *helpPages);
		sprintf(expr, "gf.help(\"%s\")", *helpPages);
		addNew(cmd,               expr,                      0, ""     );
	} while (*++helpPages);

	addNew  ("history",         "gf.history()",            0, ""     );
	addNew  ("map ",            "gf.map(%)",              -2, "s"    );
	addNew  ("new ",            "gf.new(%)",               1, ""     );
	addAlias("n ");
	addNew  ("close",           "gf.close()",              0, ""     );
	addNew  ("open ",           "gf.open(%)",              1, "p"    );
	addAlias("o ");
	addNew  ("quit",            "gf.quit()",               0, ""     );
	addAlias("q");
	addAlias("exit");
	addNew  ("rotate ",         "gf.rotate(%)",           -3, ""     );
	addAlias("rot ");
	addNew  ("reset rotation",  "gf.resetRotation()",      0, ""     );
	addAlias("reset rot");
	addNew  ("reset colors",    "gf.resetColors()",        0, ""     );
	addNew  ("reset boundary",  "gf.resetBoundary()",      0, ""     );
	addNew  ("rmap ",           "gf.rmap(%)",             -3, "s-"   );

	consoleCmdSetUpdateCmds();

	addNew  ("source ",         "gf.source(%)",            1, "p"    );
	addAlias("so ");
	addNew  ("vertex add",      "gf.vertexSelect(gf.vertexAdd())",
	                                                       0, ""     );
	addAlias("vert add");
	addNew  ("vertex add ",
	  "gf.vertexSelect(gf.vertexAdd(gf.posRotateBack(tuple(([%]+[0]*100)[:gf.get_dimen()]))))",
	                                                 INT_MIN, ""     );
	addAlias("vert add ");
	addNew  ("vertex deselect", "gf.vertexDeselect()",     0, ""     );
	addAlias("vertex desel");
	addAlias("vert deselect");
	addAlias("vert desel");
	addNew  ("vertex move ",
	  "gf.vertexSetPos(gf.vertexSelected(),tuple(map(sum,zip(gf.posRotateBack(tuple(([%]+[0]*100)[:gf.get_dimen()])),gf.vertexGetPos(gf.vertexSelected())))))",
	                                                 INT_MIN, ""    );
	addAlias("vert move ");
	addNew  ("vertex next",     "gf.vertexNext()",         0, ""     );
	addAlias("vert next");
	addNew  ("vertex previous", "gf.vertexPrevious()",     0, ""     );
	addAlias("vertex prev");
	addAlias("vert previous");
	addAlias("vert prev");
	addNew  ("vertex remove",
	  "gf.vertexRemove(gf.vertexSelected())",              0, ""     );
	addAlias("vertex rm");
	addAlias("vert remove");
	addAlias("vert rm");
	addNew  ("vertex select",   "gf.vertexSelected()",     0, ""     );
	addAlias("vertex sel");
	addNew  ("vertex select ",  "gf.vertexSelect(%)",      1, ""     );
	addAlias("vertex sel ");
	addAlias("vert select ");
	addAlias("vert sel ");
	addNew  ("write ",          "gf.write(%)",             1, "p"    );
	addAlias("w ");
}
/*! Add field names to index or metadata for an existing file class 
 * specification.
 */
static bool augmentSpec(indri::parse::FileClassEnvironmentFactory::Specification *spec,
                        std::vector<std::string>& fields,
                        std::vector<std::string>& metadata,
                        std::vector<std::string>& metadataForward,
                        std::vector<std::string>& metadataBackward ) {
  // add to index and metadata fields in spec if necessary. 
  // return true if a field is changed.
  bool retval = false;
  // input field names are potentially conflated names:
  // eg headline for head, hl, or headline tags.
  std::vector<std::string> conflations;
  std::vector<std::string>::iterator i1;
  std::vector<std::string> origIndex = spec->index;
  std::vector<std::string> origInclude = spec->include;
  
  for (i1 = fields.begin(); i1 != fields.end(); i1++) {
    // find any conflated names
    conflations = findConflations(spec, *i1);
    for (size_t j = 0; j < conflations.size(); j++) {
      // only add the field for indexing if it doesn't already exist
      if (addNew(origIndex, spec->index, conflations[j], 
                 spec->name, " as an indexed field")) {
        // added a field, make sure it is indexable
        // only add include tags if there are some already.
        // if it is empty, *all* tags are included.
        if( !spec->include.empty() ) {
          addNew(origInclude, spec->include, conflations[j], spec->name,
                 " as an included tag");
        }
        retval = true;
      }
    }
  }

  // add fields that should be marked metadata for retrieval
  for (i1 = metadata.begin(); i1 != metadata.end(); i1++) {
    // find any conflated names
    conflations = findConflations(spec, *i1);
    for (size_t j = 0; j < conflations.size(); j++)
      retval |= addNew(spec->metadata, spec->metadata, conflations[j], spec->name,
                       " as a metadata field");
  }
  // add fields that should have a metadata forward lookup table.
  for (i1 = metadataForward.begin(); i1 != metadataForward.end(); i1++) {
    // find any conflated names
    conflations = findConflations(spec, *i1);
    for (size_t j = 0; j < conflations.size(); j++) 
      retval |= addNew(spec->metadata, spec->metadata, conflations[j], spec->name,
                       " as a forward indexed metadata field");
  }
  // add fields that should have a metadata reverse lookup table.
  for (i1 = metadataBackward.begin(); i1 != metadataBackward.end(); i1++) {
    // find any conflated names
    conflations = findConflations(spec, *i1);
    for (size_t j = 0; j < conflations.size(); j++) 
      retval |= addNew(spec->metadata, spec->metadata, conflations[j], spec->name,
                       " as a backward indexed metadata field");
  }

  return retval;
}