bool KAccelBase::setActionSlot(const QString &sAction, const QObject *pObjSlot, const char *psMethodSlot) { kdDebug(125) << "KAccelBase::setActionSlot( " << sAction << ", " << pObjSlot << ", " << psMethodSlot << " )\n"; KAccelAction *pAction = m_rgActions.actionPtr(sAction); if(pAction) { // If there was a previous connection, remove it. if(m_bAutoUpdate && pAction->isConnected()) { kdDebug(125) << "\tm_pObjSlot = " << pAction->m_pObjSlot << " m_psMethodSlot = " << pAction->m_psMethodSlot << endl; removeConnection(pAction); } pAction->m_pObjSlot = pObjSlot; pAction->m_psMethodSlot = psMethodSlot; // If we're setting a connection, if(m_bAutoUpdate && pObjSlot && psMethodSlot) insertConnection(pAction); return true; } else return false; }
void ClassGraph::insertConnection(int node1, const ModelType *type, const ClassConnectItem &connectItem) { if(type) { size_t n2Index = getNodeIndex(type); if(n2Index != NO_INDEX) { insertConnection(node1, n2Index, connectItem); } } }
void ZoneConnections::insertConnection(size_t nodeIndex, const ModelClassifier *classifier, ReverseIndexLookup const &indexLookup, eZoneDependencyDirections zdd) { size_t secondIndex = indexLookup.getClassIndex(classifier); if(secondIndex != NO_INDEX) // NO_INDEX is not a class, or is not in the list of indexed classes. { if(nodeIndex != secondIndex) { insertConnection(nodeIndex, secondIndex, zdd); } } }
void SharedConnectionsDialog::sl_addClicked() { QObjectScopedPointer<EditConnectionDialog> editDialog = new EditConnectionDialog(this); const int dialogResult = editDialog->exec(); CHECK(!editDialog.isNull(), ); if (QDialog::Accepted == dialogResult) { checkDbConnectionDuplicate(editDialog->getShortDbiUrl(), editDialog->getUserName()); QListWidgetItem* item = insertConnection(editDialog->getName(), editDialog->getShortDbiUrl(), editDialog->getUserName()); CHECK(NULL != item, ); ui->lwConnections->setCurrentItem(item); saveRecentConnection(item); findUpgradeTasks(); updateState(); }
KAccelAction *KAccelBase::insert(const QString &sAction, const QString &sDesc, const QString &sHelp, const KShortcut &rgCutDefaults3, const KShortcut &rgCutDefaults4, const QObject *pObjSlot, const char *psMethodSlot, bool bConfigurable, bool bEnabled) { // kdDebug(125) << "KAccelBase::insert() begin" << endl; KAccelAction *pAction = m_rgActions.insert(sAction, sDesc, sHelp, rgCutDefaults3, rgCutDefaults4, pObjSlot, psMethodSlot, bConfigurable, bEnabled); if(pAction && m_bAutoUpdate) insertConnection(pAction); // kdDebug(125) << "KAccelBase::insert() end" << endl; return pAction; }
int main(int argc, char * * argv) { //Verify that the correct number of arguments is given if(argc != 2) FATAL("Invalid number of command line arguments!"); //Open the map file for reading FILE * map = fopen(argv[1], "r"); //Read the number of vertices in the file int numVertices = readNumberFromFile(map); //Read the number of edges in the file int numEdges = readNumberFromFile(map); //Read vertice data and assign it to nodal linked list "vertex" int nodenum = readNumberFromFile(map); int nodexcoord = readNumberFromFile(map); int nodeycoord = readNumberFromFile(map); Node * vertex = nodeConstructor(nodenum, nodexcoord, nodeycoord); int i; Node * tmpitr = vertex; for(i = 1; i < numVertices; ++i) { nodenum = readNumberFromFile(map); nodexcoord = readNumberFromFile(map); nodeycoord = readNumberFromFile(map); tmpitr->next = nodeConstructor(nodenum, nodexcoord, nodeycoord); tmpitr = tmpitr->next; } //Read edge data from the file and assign it to respective lists for(i = 0; i < numEdges; ++i) { int firstnode = readNumberFromFile(map); int secondnode = readNumberFromFile(map); insertConnection(vertex, firstnode, secondnode); } //Print adjacency relationships tmpitr = vertex; EdgeList * itrEdge = NULL; while(tmpitr != NULL) { printf("%d: ", tmpitr->value); itrEdge = tmpitr->edges; while(itrEdge != NULL) { printf("%d ", itrEdge->connectedto); itrEdge = itrEdge->next; } printf("\n"); tmpitr = tmpitr->next; } return EXIT_SUCCESS; }
bool KAccelBase::setShortcut(const QString &sAction, const KShortcut &cut) { KAccelAction *pAction = actionPtr(sAction); if(pAction) { if(m_bAutoUpdate) removeConnection(pAction); pAction->setShortcut(cut); if(m_bAutoUpdate && !pAction->shortcut().isNull()) insertConnection(pAction); return true; } else return false; }
bool KAccelBase::setActionEnabled(const QString &sAction, bool bEnable) { KAccelAction *pAction = actionPtr(sAction); if(pAction) { if(pAction->m_bEnabled != bEnable) { kdDebug(125) << "KAccelBase::setActionEnabled( " << sAction << ", " << bEnable << " )" << endl; pAction->m_bEnabled = bEnable; if(m_bAutoUpdate) { // FIXME: the action may already have it's connections inserted! if(bEnable) insertConnection(pAction); else if(pAction->isConnected()) removeConnection(pAction); } } return true; } return false; }
void ClassGraph::updateConnections(const ModelData &modelData) { mConnectMap.clear(); // Diagram *node1, Diagram *node2 for(size_t ni=0; ni<mNodes.size(); ni++) { const ModelType *type = mNodes[ni].getType(); if(type) { if(mGraphOptions.drawTemplateRelations) { // Go through templates if(type->isTemplateUseType()) { ConstModelClassifierVector relatedClassifiers; modelData.getRelatedTypeArgClasses(*type, relatedClassifiers); for(auto const &cl : relatedClassifiers) { insertConnection(ni, cl, ClassConnectItem(ctTemplateDependency)); } } } const ModelClassifier *classifier = type->getClass(); if(classifier) { // Get attributes of classifier, and get the decl type for(const auto &attr : classifier->getAttributes()) { insertConnection(ni, attr->getDeclType(), ClassConnectItem(ctAggregation, attr->isConst(), attr->isRefer(), attr->getAccess())); } if(mGraphOptions.drawOperParamRelations) { // Get operations parameters of classifier, and get the decl type ConstModelDeclClasses declClasses; modelData.getRelatedFuncParamClasses(*classifier, declClasses); for(const auto &declCl : declClasses) { const ModelDeclarator *decl = declCl.getDecl(); insertConnection(ni, declCl.getClass(), ClassConnectItem(ctFuncParam, decl->isConst(), decl->isRefer(), Visibility())); } } if(mGraphOptions.drawOperBodyVarRelations) { // Get operations parameters of classifier, and get the decl type ConstModelDeclClasses declClasses; modelData.getRelatedBodyVarClasses(*classifier, declClasses); for(const auto &declCl : declClasses) { const ModelDeclarator *decl = declCl.getDecl(); insertConnection(ni, declCl.getClass(), ClassConnectItem(ctFuncVar, decl->isConst(), decl->isRefer(), Visibility())); } } // Go through associations, and get related classes. for(const auto &assoc : modelData.mAssociations) { size_t n1Index = NO_INDEX; size_t n2Index = NO_INDEX; if(assoc->getChild() == classifier) { n1Index = getNodeIndex(assoc->getParent()); n2Index = ni; } else if(assoc->getParent() == classifier) { n1Index = ni; n2Index = getNodeIndex(assoc->getChild()); } if(n1Index != NO_INDEX && n2Index != NO_INDEX) { insertConnection(n1Index, n2Index, ClassConnectItem(ctIneritance, assoc->getAccess())); } } } } } }
int main(int argc, char * * argv) { //Verify that the correct number of arguments is given if(argc != 3) FATAL("Invalid number of command line arguments!"); //Open the map file for reading FILE * map = fopen(argv[1], "r"); //Read the number of vertices in the file int numVertices = readNumberFromFile(map); //Read the number of edges in the file int numEdges = readNumberFromFile(map); //Read vertice data and assign it to nodal linked list "vertex" int nodenum = readNumberFromFile(map); int nodexcoord = readNumberFromFile(map); int nodeycoord = readNumberFromFile(map); Node * vertex = nodeConstructor(nodenum, nodexcoord, nodeycoord); int i; Node * tmpitr = vertex; for(i = 1; i < numVertices; ++i) { nodenum = readNumberFromFile(map); nodexcoord = readNumberFromFile(map); nodeycoord = readNumberFromFile(map); tmpitr->next = nodeConstructor(nodenum, nodexcoord, nodeycoord); tmpitr = tmpitr->next; } //Read edge data from the file and assign it to respective lists for(i = 0; i < numEdges; ++i) { int firstnode = readNumberFromFile(map); int secondnode = readNumberFromFile(map); insertConnection(vertex, firstnode, secondnode); } fclose(map); //NOTE: At this point, the graph is complete, so begin algorithm //Open the query file for reading FILE * query = fopen(argv[2], "r"); //Read the number of queries int numQueries = readNumberFromFile(query); //Read query data and store it for reference int * queryArr = readQueries(query, numQueries); //Store origin node in list Node * origin = vertex; //Loop through the queries for(i = 0; i < (numQueries * 2); i += 2) { //Find the starting point of the query int startVal = queryArr[i]; int endVal = queryArr[i+1]; //If they're the same, avoid trying to do anything else if(startVal == endVal) { printf("0\n"); printf("%d %d\n", startVal, endVal); } else { Node * start = findVertexByValue(startVal, origin); Node * end = findVertexByValue(endVal, origin); start->weight = 0; while(areAllNotRemoved(origin)) { //Set the weight check to find minimum node Node * itrNode = findLowestNode(origin); //Make sure we're not done if(itrNode->value == endVal) break; //Update weights for adjacent nodes updateAdjacentWeights(itrNode, origin); } if(end->weight == PSEUDOINF) FATAL("Final node weight was not updated... possibly unconnected?"); //Produce the result list ResultList * results = reslistConstructor(end->value, end->weight); Node * before = findVertexByValue(end->prev, origin); while(before->value != startVal) { ResultList * pinonfront = reslistConstructor(before->value, before->weight); pinonfront->next = results; results = pinonfront; before = findVertexByValue(before->prev, origin); } //Make sure the first number in the list is origin if(results->value != startVal) { ResultList * pinonfront2 = reslistConstructor(startVal, start->weight); pinonfront2->next = results; results = pinonfront2; } //Verify weights and assign the end weight //end->weight = verifyWeightsAndAssign(results, origin); //Print the final results printf("%ld\n", end->weight); ResultList * printitr = results; while(printitr != NULL) { printf("%d ", printitr->value); printitr = printitr->next; } printf("\n"); reslistDestroy(results); resetGraph(origin); } } //Free used memory fclose(query); free(queryArr); nodeDestroy(origin); return EXIT_SUCCESS; }
void DataPort::appendChild( DataAbstractItem *child ) { DataConnection* c = static_cast<DataConnection*>(child); insertConnection(c); }