void Queue::recursiveUpdate(Node * node, sf::Vector2f lastPos)
{
	sf::Vector2f tempPos2 = node->img.getPosition();
	node->img.setPosition(lastPos);
	if (node->next != nullptr) {
		recursiveUpdate(node->next, tempPos2);
	}
}
Exemple #2
0
void FormWindowBase::setFeatures(Feature f)
{
    m_d->m_feature = f;
    const bool enableGrid = f & GridFeature;
    m_d->m_grid.setVisible(enableGrid);
    m_d->m_grid.setSnapX(enableGrid);
    m_d->m_grid.setSnapY(enableGrid);
    emit featureChanged(f);
    recursiveUpdate(this);
}
Exemple #3
0
static void recursiveUpdate(QWidget *w)
{
    w->update();

    const QObjectList &l = w->children();
    const QObjectList::const_iterator cend = l.constEnd();
    for (QObjectList::const_iterator it = l.constBegin(); it != cend; ++it) {
        if (QWidget *w = qobject_cast<QWidget*>(*it))
            recursiveUpdate(w);
    }
}
Exemple #4
0
void linex::put(const char *key, int16_t key_len, const char *value,
        int16_t value_len) {
    byte *node_paths[7];
    linex_node_handler node(root_data);
    node.key = key;
    node.key_len = key_len;
    node.value = value;
    node.value_len = value_len;
    node.isPut = true;
    if (node.filledSize() == 0) {
        node.addData();
        total_size++;
    } else {
        if (!node.isLeaf())
            node.traverseToLeaf(node_paths);
        node.locate();
        recursiveUpdate(&node, -1, node_paths, numLevels - 1);
    }
}
void Queue::update(float gameTime, int direction)
{
	if (!empty()) {
		sf::Vector2f tempPos = first->img.getPosition();
		if (direction == Direction::up) {
			first->img.setPosition(first->img.getPosition().x, first->img.getPosition().y - 25);
		}
		else if (direction == Direction::down) {
			first->img.setPosition(first->img.getPosition().x, first->img.getPosition().y + 25);
		}
		else if (direction == Direction::left) {
			first->img.setPosition(first->img.getPosition().x - 25, first->img.getPosition().y);
		}
		else if (direction == Direction::right) {
			first->img.setPosition(first->img.getPosition().x + 25, first->img.getPosition().y);
		}
		if (first->next != nullptr) {
			recursiveUpdate(first->next, tempPos);
		}
	}
}
Exemple #6
0
void FormWindowBase::setDesignerGrid(const  Grid& grid)
{
    m_d->m_grid = grid;
    syncGridFeature();
    recursiveUpdate(this);
}
Exemple #7
0
void linex::recursiveUpdate(linex_node_handler *node, int16_t pos,
        byte *node_paths[], int16_t level) {
    int16_t idx = pos;
    if (idx < 0) {
        idx = ~idx;
        if (node->isFull(node->key_len + node->value_len)) {
            //std::cout << "Full\n" << std::endl;
            //if (maxKeyCount < block->filledSize())
            //    maxKeyCount = block->filledSize();
            //printf("%d\t%d\t%d\n", block->isLeaf(), block->filledSize(), block->TRIE_LEN);
            //cout << (int) node->TRIE_LEN << endl;
            if (node->isLeaf()) {
                maxKeyCountLeaf += node->filledSize();
                blockCountLeaf++;
            } else {
                maxKeyCountNode += node->filledSize();
                blockCountNode++;
            }
            //    maxKeyCount += node->TRIE_LEN;
            //maxKeyCount += node->PREFIX_LEN;
            byte first_key[64];
            int16_t first_len;
            byte *b = node->split(first_key, &first_len);
            linex_node_handler new_block(b);
            new_block.isPut = true;
            int16_t cmp = util::compare((char *) first_key, first_len,
                    node->key, node->key_len);
            if (cmp <= 0) {
                new_block.initVars();
                new_block.key = node->key;
                new_block.key_len = node->key_len;
                new_block.value = node->value;
                new_block.value_len = node->value_len;
                new_block.pos = ~new_block.locate();
                new_block.addData();
            } else {
                node->initVars();
                node->pos = ~node->locate();
                node->addData();
            }
            if (root_data == node->buf) {
                blockCountNode++;
                root_data = (byte *) util::alignedAlloc(LINEX_NODE_SIZE);
                linex_node_handler root(root_data);
                root.initBuf();
                root.isPut = true;
                root.setLeaf(0);
                byte addr[9];
                util::ptrToBytes((unsigned long) node->buf, addr);
                root.initVars();
                root.key = "";
                root.key_len = 1;
                root.value = (char *) addr;
#if defined(ENV64BIT)
                root.value_len = 5;
#else
                root.value_len = 4;
#endif
                root.addData();
                util::ptrToBytes((unsigned long) new_block.buf, addr);
                root.initVars();
                root.key = (char *) first_key;
                root.key_len = first_len;
                root.value = (char *) addr;
                //root.value_len = sizeof(char *);
                root.pos = ~root.locate();
                root.addData();
                numLevels++;
            } else {
                int16_t prev_level = level - 1;
                byte *parent_data = node_paths[prev_level];
                linex_node_handler parent(parent_data);
                byte addr[9];
                util::ptrToBytes((unsigned long) new_block.buf, addr);
                parent.initVars();
                parent.isPut = true;
                parent.key = (char *) first_key;
                parent.key_len = first_len;
                parent.value = (char *) addr;
#if defined(ENV64BIT)
                parent.value_len = 5;
#else
                parent.value_len = 4;
#endif
                parent.locate();
                recursiveUpdate(&parent, parent.pos, node_paths, prev_level);
            }
        } else {
            node->pos = idx;
            node->addData();
        }
    } else {
        //if (node->isLeaf) {
        //    int16_t vIdx = idx + mSizeBy2;
        //    returnValue = (V) arr[vIdx];
        //    arr[vIdx] = value;
        //}
    }
}