void FileBrowserComponent::comboBoxChanged (ComboBox*)
{
    const String newText (currentPathBox.getText().trim().unquoted());

    if (newText.isNotEmpty())
    {
        const int index = currentPathBox.getSelectedId() - 1;

        StringArray rootNames, rootPaths;
        getRoots (rootNames, rootPaths);

        if (rootPaths [index].isNotEmpty())
        {
            setRoot (File (rootPaths [index]));
        }
        else
        {
            File f (newText);

            for (;;)
            {
                if (f.isDirectory())
                {
                    setRoot (f);
                    break;
                }

                if (f.getParentDirectory() == f)
                    break;

                f = f.getParentDirectory();
            }
        }
    }
}
void main(int argc,char* argv[])
{	//system ("chcp 1251");

	int num1=32,num2=2;

	memset(factors,-1,sizeof(factors)/sizeof(factors[0]));
	memset(pRoots,0,sizeof(pRoots)/sizeof(pRoots[0]));
	memset(Roots,0,sizeof(Roots)/sizeof(Roots[0]));

	//getFactors(num1,factors);
	//len=getQuantityOfFactors(factors);
	//printf("Quantity of factors is %d\n",len);
	getPossibleRoots(num1,num2,pRoots);
	int rootsNumber=0;
	rootsNumber=getRoots(pRoots,possibleRootCounter);

	printf("possibleRootCounter of %d is %d\n",num1,possibleRootCounter);
	printf("rootsCounter of %d is %d\n",num1,rootsNumber);
	printf("roots[0] of %d is %f\n",num1,Roots[0]);
	printf("roots[1] of %d is %f\n",num1,Roots[1]);
	printf("roots[2] of %d is %f\n",num1,Roots[2]);
	printf("roots[3] of %d is %f\n",num1,Roots[3]);
	printf("roots[4] of %d is %f\n",num1,Roots[4]);
	printf("roots[5] of %d is %f\n",num1,Roots[5]);
	printf("roots[6] of %d is %f\n",num1,Roots[6]);
	printf("roots[7] of %d is %f\n",num1,Roots[7]);

	getchar();

}
示例#3
0
文件: test.cpp 项目: jcelaya/stars
 void postEnd() {
     std::set<unsigned int> roots = getRoots();
     Logger::msg("Sim.Tree", WARN, roots.size(), " different trees.");
     showStructureTree(roots);
     checkStructureTree();
     showInfoTree(roots);
     checkInfoTree();
 }
void FileBrowserComponent::setRoot (const File& newRootDirectory)
{
    bool callListeners = false;

    if (currentRoot != newRootDirectory)
    {
        callListeners = true;
        fileListComponent->scrollToTop();

        String path (newRootDirectory.getFullPathName());

        if (path.isEmpty())
            path = File::separatorString;

        StringArray rootNames, rootPaths;
        getRoots (rootNames, rootPaths);

        if (! rootPaths.contains (path, true))
        {
            bool alreadyListed = false;

            for (int i = currentPathBox.getNumItems(); --i >= 0;)
            {
                if (currentPathBox.getItemText (i).equalsIgnoreCase (path))
                {
                    alreadyListed = true;
                    break;
                }
            }

            if (! alreadyListed)
                currentPathBox.addItem (path, currentPathBox.getNumItems() + 2);
        }
    }

    currentRoot = newRootDirectory;
    fileList->setDirectory (currentRoot, true, true);

    if (FileTreeComponent* tree = dynamic_cast<FileTreeComponent*> (fileListComponent.get()))
        tree->refresh();

    String currentRootName (currentRoot.getFullPathName());
    if (currentRootName.isEmpty())
        currentRootName = File::separatorString;

    currentPathBox.setText (currentRootName, dontSendNotification);

    goUpButton->setEnabled (currentRoot.getParentDirectory().isDirectory()
                            && currentRoot.getParentDirectory() != currentRoot);

    if (callListeners)
    {
        Component::BailOutChecker checker (this);
        listeners.callChecked (checker, &FileBrowserListener::browserRootChanged, currentRoot);
    }
}
void FileBrowserComponent::resetRecentPaths()
{
    currentPathBox.clear();

    StringArray rootNames, rootPaths;
    getRoots (rootNames, rootPaths);

    for (int i = 0; i < rootNames.size(); ++i)
    {
        if (rootNames[i].isEmpty())
            currentPathBox.addSeparator();
        else
            currentPathBox.addItem (rootNames[i], i + 1);
    }

    currentPathBox.addSeparator();
}
void FileBrowserComponent::setRoot (const File& newRootDirectory)
{
    if (currentRoot != newRootDirectory)
    {
        fileListComponent->scrollToTop();

        String path (newRootDirectory.getFullPathName());

        if (path.isEmpty())
            path = File::separatorString;

        StringArray rootNames, rootPaths;
        getRoots (rootNames, rootPaths);

        if (! rootPaths.contains (path, true))
        {
            bool alreadyListed = false;

            for (int i = currentPathBox.getNumItems(); --i >= 0;)
            {
                if (currentPathBox.getItemText (i).equalsIgnoreCase (path))
                {
                    alreadyListed = true;
                    break;
                }
            }

            if (! alreadyListed)
                currentPathBox.addItem (path, currentPathBox.getNumItems() + 2);
        }
    }

    currentRoot = newRootDirectory;
    fileList->setDirectory (currentRoot, true, true);

    String currentRootName (currentRoot.getFullPathName());
    if (currentRootName.isEmpty())
        currentRootName = File::separatorString;

    currentPathBox.setText (currentRootName, true);

    goUpButton->setEnabled (currentRoot.getParentDirectory().isDirectory()
                             && currentRoot.getParentDirectory() != currentRoot);
}
示例#7
0
void causalgraph::computeLinks(std::vector<recyclegate*> operationOrder)
{
	for(std::list<recyclegate*>::iterator it = tmpCircuit.begin();
					it != tmpCircuit.end(); it++)
	{
		(*it)->willPush.clear();
		(*it)->pushedBy.clear();
	}

	std::map<wireelement*, recyclegate*> lastSeen;
//    int lines = getRoots().size();
	std::vector<recyclegate*> roots = getRoots();

    for(size_t i = 0; i < roots.size(); i++)
    {
        lastSeen[roots[i]->wirePointers[0]] = NULL; //the ids of the inputs
    }

    for(std::vector<recyclegate*>::iterator itOperation = operationOrder.begin();
    		itOperation != operationOrder.end(); itOperation++)
    {
    	//ce cauta nrWire aici?
    	int nrWire = 0;
        for(std::vector<wireelement*>::iterator itWire = (*itOperation)->wiresToUseForLinks.begin();
        		itWire != (*itOperation)->wiresToUseForLinks.end(); itWire++)
        {
        	//if(*itWire < lines)
//        	{
        		if(lastSeen[*itWire] != NULL)
        		{
        			//the same wire for both gates
//        			connectNodes(*itWire, *itWire, lastSeen[*itWire], *itOperationId);
        			connectNodes(-1, nrWire, lastSeen[*itWire], *itOperation);
        		}
        		lastSeen[*itWire] = *itOperation;

        		nrWire++;
//        	}
        }
    }

}
示例#8
0
int causalgraph::getNrQubits()
{
	//return nrQubits;
	//is this the number of roots?
	return getRoots().size();
}