Exemple #1
0
	node<V>* _removeMinimum(node<V>* n) {
		_unMarkAndUnParentAll(n->child);
		if(n->next==n) {
			n=n->child;
		} else {
			n->next->prev=n->prev;
			n->prev->next=n->next;
			n=_merge(n->next,n->child);
		}
		if(n==NULL)return n;
		node<V>* trees[64]={NULL};

		while(true) {
			if(trees[n->degree]!=NULL) {
				node<V>* t=trees[n->degree];
				if(t==n)break;
				trees[n->degree]=NULL;
				if(n->value<t->value) {
					t->prev->next=t->next;
					t->next->prev=t->prev;
					_addChild(n,t);
				} else {
					t->prev->next=t->next;
					t->next->prev=t->prev;
					if(n->next==n) {
						t->next=t->prev=t;
						_addChild(t,n);
						n=t;
					} else {
						n->prev->next=t;
						n->next->prev=t;
						t->next=n->next;
						t->prev=n->prev;
						_addChild(t,n);
						n=t;
					}
				}
				continue;
			} else {
				trees[n->degree]=n;
			}
			n=n->next;
		}
		node<V>* min=n;
		do {
			if(n->value<min->value)min=n;
			n=n->next;
		} while(n!=n);
		return min;
	}
Exemple #2
0
/* The constructor */
MainWindow newMainWindow(HINSTANCE hInstance){ SELFREF_INIT;
	ALLOC_THIS(MainWindow);
	int i, j;
	
	this->moduleInstance = hInstance;
	CLASS_MainWindow;
	initWindow((Window)this, hInstance, (char*)windowTitle, windowWidth, windowHeight);

	$(this)_addChild((GUIObject)(this->panel));

	//$(this->panel)_addChild((GUIObject)this->btn);


	for (i = 0; i < 4; i++){
		for (j = 0; j < 4; j++)
			(this->tiles)[i][j] = NULL;
	}

	addRandomTile(this);
	addRandomTile(this);



	this->panel->styles = WS_CHILD | WS_BORDER | WS_THICKFRAME;
	$(this->panel)_setResizable(FALSE);
	$(this)_setEvent(WM_KEYDOWN, onKeyDown, NULL, SYNC);

	this->panel->maxWidth = this->panel->width;
	this->panel->maxHeight = this->panel->height;

	this->panel->x = 10;
	this->panel->y = 10;

	return this;
}
Exemple #3
0
PRIVATE void addRandomTile(MAKE_THIS(MainWindow)){ SELFREF_INIT;
	int x, y, value = rand() % 10 < 9 ? 2 : 4; /* Same condition as it original 2048 */
	while (x = rand() % 4, y = rand() % 4, this->tiles[y][x]);
	this->tiles[y][x] = newTile(this->panel->moduleInstance, value, x, y);

	$(this->panel)_addChild((GUIObject)(this->tiles[y][x]));
	displayControl((Control)(this->tiles[y][x]));

	SendMessageA(this->tiles[y][x]->handle, WM_PAINT, (WPARAM)NULL, (LPARAM)NULL); /* Force repaint after the object has been created */
}
Exemple #4
0
err_t Object::addChild(Object* child)
{
  if (FOG_IS_NULL(child))
    return ERR_RT_INVALID_ARGUMENT;

  // If object is already in our hierarchy then we return quickly.
  if (child->getParent() == this)
    return ERR_OK;

  // If object has different parent then it's an error.
  if (child->hasParent())
    return ERR_OBJECT_HAS_PARENT;

  // Okay, now we can call the virtual _addChild() method.
  return _addChild(_objectExtra->_children.getLength(), child);
}
Exemple #5
0
void DirBlob::AddChildSymlink(const std::string &name, const blockstore::Key &blobKey, uid_t uid, gid_t gid, timespec lastAccessTime, timespec lastModificationTime) {
  std::unique_lock<std::mutex> lock(_mutex);
  _addChild(name, blobKey, fspp::Dir::EntryType::SYMLINK, S_IFLNK | S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH, uid, gid, lastAccessTime, lastModificationTime);
}
Exemple #6
0
void DirBlob::AddChildFile(const std::string &name, const Key &blobKey, mode_t mode, uid_t uid, gid_t gid, timespec lastAccessTime, timespec lastModificationTime) {
  std::unique_lock<std::mutex> lock(_mutex);
  _addChild(name, blobKey, fspp::Dir::EntryType::FILE, mode, uid, gid, lastAccessTime, lastModificationTime);
}
Exemple #7
0
//! ---|> Component
void Connector::addConnectorPoint(){
	auto p=new ConnectorPoint(getGUI());
	_addChild(p);
}