当前位置: 首页>>代码示例>>C++>>正文


C++ ListIterator::valid方法代码示例

本文整理汇总了C++中ListIterator::valid方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIterator::valid方法的具体用法?C++ ListIterator::valid怎么用?C++ ListIterator::valid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListIterator的用法示例。


在下文中一共展示了ListIterator::valid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

Graph::~Graph()
{
	ListIterator<NodeArrayBase*> itVNext;
	for(ListIterator<NodeArrayBase*> itV = m_regNodeArrays.begin();
		itV.valid(); itV = itVNext)
	{
		itVNext = itV.succ();
		(*itV)->disconnect();
	}

	ListIterator<EdgeArrayBase*> itENext;
	for(ListIterator<EdgeArrayBase*> itE = m_regEdgeArrays.begin();
		itE.valid(); itE = itENext)
	{
		itENext = itE.succ();
		(*itE)->disconnect();
	}

	ListIterator<AdjEntryArrayBase*> itAdjNext;
	for(ListIterator<AdjEntryArrayBase*> itAdj = m_regAdjArrays.begin();
		itAdj.valid(); itAdj = itAdjNext)
	{
		itAdjNext = itAdj.succ();
		(*itAdj)->disconnect();
	}

	for (node v = m_nodes.begin(); v; v = v->succ()) {
		v->m_adjEdges.~GraphList<AdjElement>();
	}
}
开发者ID:rizo,项目名称:qml-ogdf,代码行数:30,代码来源:Graph.cpp

示例2: replaceByStar

node UMLGraph::replaceByStar(List<node> &clique, NodeArray<int> &cliqueNum)
{
	if (clique.empty()) return nullptr;
	//insert an additional center node

	node center = m_pG->newNode();
	width(center) = m_cliqueCenterSize;
	height(center) = m_cliqueCenterSize;
#ifdef OGDF_DEBUG
//should ask for attributes
	if(has(nodeStyle))
		fillColor(center) = Color(0x55,0x55,0x55);
#endif
	//we delete all edges inzident to two clique nodes
	//store all of them first in delEdges
	List<edge> delEdges;
//TODO: Store edge type for all deleted edges
	ListIterator<node> it = clique.begin();
	while (it.valid())
	{
		node v = (*it);

		int numIt = cliqueNum[v];

		for(adjEntry ad : v->adjEntries)
		{
			if (cliqueNum[ad->twinNode()] == numIt)
			{
				if (ad->theEdge()->source() == v)
				{
					//m_cliqueEdges[v].pushBack(new CliqueInfo(ad->theEdge()->target(), ad->theEdge()->index()));
					delEdges.pushBack(ad->theEdge());
				}
			}//if
		}

		//connect center node to clique node
		edge inserted = m_pG->newEdge(center, v);
		this->type(inserted) = Graph::association;
		m_replacementEdge[inserted] = true;

		++it;
	}//while

	//now delete all edges
	ListIterator<edge>	itEdge = delEdges.begin();
	while (itEdge.valid())
	{
		//m_pG->delEdge((*itEdge));
		m_hiddenEdges->hide(*itEdge);
		++itEdge;
	}//while

	return center;
}//replaceByStar
开发者ID:marvin2k,项目名称:ogdf,代码行数:55,代码来源:UMLGraph.cpp

示例3: replaceByStar

node CliqueReplacer::replaceByStar(List<node> &clique, NodeArray<int> &cliqueNum)
{
    if (clique.empty()) return 0;
    //insert an additional center node

    node center = m_G.newNode();
    m_ga.width(center) = m_cliqueCenterSize;
    m_ga.height(center) = m_cliqueCenterSize;
#ifdef OGDF_DEBUG
    //should ask for attributes
    if(m_ga.attributes() & GraphAttributes::nodeStyle)
        m_ga.fillColor(center) = Color(0x55,0x55,0x55);
#endif
    //we delete all edges inzident to two clique nodes
    //store all of them first in delEdges
    List<edge> delEdges;
    ListIterator<node> it = clique.begin();
    while (it.valid())
    {
        node v = (*it);

        adjEntry ad;
        int numIt = cliqueNum[v];

        forall_adj(ad, v)
        {
            if (cliqueNum[ad->twinNode()] == numIt)
            {
                if (ad->theEdge()->source() == v)
                {
                    //m_cliqueEdges[v].pushBack(new CliqueInfo(ad->theEdge()->target(), ad->theEdge()->index()));
                    delEdges.pushBack(ad->theEdge());
                }
            }//if
        }//foralladj

        //connect center node to clique node
        edge inserted = m_G.newEdge(center, v);
        m_replacementEdge[inserted] = true;

        it++;
    }//while

    //now delete all edges
    ListIterator<edge>	itEdge = delEdges.begin();
    while (itEdge.valid())
    {
        //m_pG->delEdge((*itEdge));
        m_G.hideEdge((*itEdge));
        itEdge++;
    }//while

    return center;
}//replaceByStar
开发者ID:mneumann,项目名称:tulip,代码行数:54,代码来源:CliqueReplacer.cpp

示例4: internalCandidateTaken

	// this functions sets the crossingMatrix according to candidateCrossings
	void Planarity::internalCandidateTaken() {
		ListIterator<ChangedCrossing> it;
		for(it = m_crossingChanges.begin(); it.valid(); ++ it) {
			ChangedCrossing cc = *(it);
			(*m_crossingMatrix)(cc.edgeNum1,cc.edgeNum2) = cc.cross;
		}
	}
开发者ID:SiteView,项目名称:NNMQT,代码行数:8,代码来源:Planarity.cpp

示例5:

	List<string> DavidsonHarel::returnEnergyFunctionNames()
	{
		List<string> names;
		ListIterator<EnergyFunction*> it;
		for(it = m_energyFunctions.begin(); it.valid(); it = it.succ())
			names.pushBack((*it)->getName());
		return names;
	}
开发者ID:mneumann,项目名称:tulip,代码行数:8,代码来源:DavidsonHarel.cpp

示例6: generateVariablesForFeasibility

void MaxCPlanarMaster::generateVariablesForFeasibility(const List<ChunkConnection*>& ccons, List<EdgeVar*>& connectVars) {
	List<ChunkConnection*> cpy(ccons);
#if 0
	for(ChunkConnection *cc : cpy) {
		cc->printMe();
	}
#endif

	ArrayBuffer<ListIterator<NodePair> > creationBuffer(ccons.size());
	for (ListIterator<NodePair> npit = m_inactiveVariables.begin(); npit.valid(); ++npit) {
		bool select = false;
#if 0
		(*npit).printMe();
#endif
		ListIterator<ChunkConnection*> ccit = cpy.begin();
		while(ccit.valid()) {
			if((*ccit)->coeff(*npit)) {
				ListIterator<ChunkConnection*> delme = ccit;
				++ccit;
				cpy.del(delme);
				select = true;
			} else
				++ccit;
		}
		if(select) {
#if 0
			Logger::slout() << "<--CREATE";
#endif
			creationBuffer.push(npit);
		}
		if(cpy.size()==0) break;
	}
#if 0
	for(ChunkConnection *cc : cpy) {
		cc->printMe();
	}
#endif
	OGDF_ASSERT(cpy.size()==0);
	Logger::slout() << "Creating " << creationBuffer.size() << " Connect-Variables for feasibility\n";
	m_varsInit = creationBuffer.size();
	// realize creationList
	for(int i = creationBuffer.size(); i-- > 0;) {
		connectVars.pushBack( createVariable( creationBuffer[i] ) );
	}
}
开发者ID:ogdf,项目名称:ogdf,代码行数:45,代码来源:MaxCPlanarMaster.cpp

示例7: computeInitialEnergy

//steps through all energy functions and adds the initial energy computed by each
//function for the start layout
void DavidsonHarel::computeInitialEnergy()
{
	OGDF_ASSERT(!m_energyFunctions.empty());
	ListIterator<EnergyFunction*> it;
	ListIterator<double> it2;
	it2 = m_weightsOfEnergyFunctions.begin();
	for(it = m_energyFunctions.begin(); it.valid() && it2.valid(); it=it.succ(), it2 = it2.succ())
		m_energy += (*it)->energy() * (*it2);
}
开发者ID:ogdf,项目名称:ogdf,代码行数:11,代码来源:DavidsonHarel.cpp

示例8:

ClusterGraph::~ClusterGraph()
{
	for(ListIterator<ClusterArrayBase*> it = m_regClusterArrays.begin();
		it.valid(); ++it)
	{
		(*it)->disconnect();
	}

	clear();
}
开发者ID:boddulavineela,项目名称:ICSE-2011-ViewInfinity,代码行数:10,代码来源:ClusterGraph.cpp

示例9:

void RadialTreeLayout::Grouping::computeAdd(double &D, double &W)
{
	D = W = 0;

	ListIterator<Group> it;
	for(it = begin(); it.valid(); ++it)
	{
		Group &g = *it;

		D += g.m_sumD;

		if(g.m_leafGroup == true)
			continue;

		W += g.m_sumW;

		ListIterator<Group> itL;

		itL = it.pred();
		if(itL.valid() == false) {
			g.m_leftAdd = 0.0;
		} else {
			ListIterator<Group> itR = itL.pred();
			if(itR.valid() == false)
				g.m_leftAdd = (*itL).m_sumD;
			else
				g.m_leftAdd = (*itL).m_sumD * g.m_sumW / (*itR).m_sumW;
		}

		itL = it.succ();
		if(itL.valid() == false) {
			g.m_leftAdd = 0.0;
		} else {
			ListIterator<Group> itR = itL.succ();
			if(itR.valid() == false)
				g.m_leftAdd = (*itL).m_sumD;
			else
				g.m_leftAdd = (*itL).m_sumD * g.m_sumW / (*itR).m_sumW;
		}
	}
}
开发者ID:lncosie,项目名称:ogdf,代码行数:41,代码来源:RadialTreeLayout.cpp

示例10: internalCandidateTaken

void NodePairEnergy::internalCandidateTaken() {
	node v = testNode();
	int candNum = (*m_nodeNums)[v];
	ListIterator<node> it;
	for(it = m_nonIsolated.begin(); it.valid(); ++ it) {
		if((*it) != v) {
			int numit = (*m_nodeNums)[*it];
			(*m_pairEnergy)(min(numit,candNum),max(numit,candNum)) = m_candPairEnergy[*it];
			m_candPairEnergy[*it] = 0.0;
		}
	}
}
开发者ID:boddulavineela,项目名称:ICSE-2011-ViewInfinity,代码行数:12,代码来源:NodePairEnergy.cpp

示例11: internalCandidateTaken

	// this functions sets the crossingMatrix according to candidateCrossings
	void Planarity::internalCandidateTaken() {
		ListIterator<ChangedCrossing> it;
		for(it = m_crossingChanges.begin(); it.valid(); ++ it) {
			ChangedCrossing cc = *(it);
			(*m_crossingMatrix)(cc.edgeNum1,cc.edgeNum2) = cc.cross;
		}
#ifdef OGDF_DEBUG
		int cros = 0;
		for(int i = 1; i < m_nonSelfLoops.size(); i++)
			for(int j = i+1; j <= m_nonSelfLoops.size(); j++)
				cros += (*m_crossingMatrix)(i,j);
		OGDF_ASSERT(cros == m_energy);
#endif
	}
开发者ID:boddulavineela,项目名称:ICSE-2011-ViewInfinity,代码行数:15,代码来源:Planarity.cpp

示例12: computeEnergy

void NodePairEnergy::computeEnergy()
{
	int n_num = m_nonIsolated.size();
	double energySum = 0.0;
	Array<node> numNodes(1,n_num);

	ListIterator<node> it;
	for(it = m_nonIsolated.begin(); it.valid(); ++it) {
		numNodes[(*m_nodeNums)[*it]] = *it;
	}
	for(int i = 1; i <= n_num-1 ; i++) {
		for(int j = i+1; j <= n_num; j++) {
			double E = computePairEnergy(numNodes[i],numNodes[j]);
			(*m_pairEnergy)(i,j) = E;
			energySum += E;
		}
	}
	m_energy = energySum;
}
开发者ID:boddulavineela,项目名称:ICSE-2011-ViewInfinity,代码行数:19,代码来源:NodePairEnergy.cpp

示例13: collapseCluster

//in ClusterGraph??
//is not yet recursive!!!
node collapseCluster(ClusterGraph& CG, cluster c, Graph& G)
{
	OGDF_ASSERT(c->cCount() == 0)

	ListIterator<node> its;
	SListPure<node> collaps;

	//we should check here if not empty
	node robinson = (*(c->nBegin()));

	for (its = c->nBegin(); its.valid(); its++)
		collaps.pushBack(*its);

	CG.collaps(collaps, G);

	if (c != CG.rootCluster())
		CG.delCluster(c);

	return robinson;
}
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:22,代码来源:extended_graph_alg.cpp

示例14: computeSinkSwitches

void UpwardPlanRep::computeSinkSwitches()
{
	OGDF_ASSERT(m_Gamma.externalFace() != nullptr);

	if (s_hat == nullptr)
		hasSingleSource(*this, s_hat);
	FaceSinkGraph fsg(m_Gamma, s_hat);
	List<adjEntry> dummyList;
	FaceArray< List<adjEntry> > sinkSwitches(m_Gamma, dummyList);
	fsg.sinkSwitches(sinkSwitches);
	m_sinkSwitchOf.init(*this, nullptr);

	for(face f : m_Gamma.faces) {
		List<adjEntry> switches = sinkSwitches[f];
		ListIterator<adjEntry> it = switches.begin();
		for (it = it.succ(); it.valid(); ++it) {
			m_sinkSwitchOf[(*it)->theNode()] = (*it);
		}
	}
}
开发者ID:ogdf,项目名称:ogdf,代码行数:20,代码来源:UpwardPlanRep.cpp

示例15: computeEnergy

	// computes energy of layout, stores it and sets the crossingMatrix
	void Planarity::computeEnergy()
	{
		int e_num = m_nonSelfLoops.size();
		int energySum = 0;
		Array<edge> numEdge(1,e_num);
		edge e;
		ListIterator<edge> it;

		for(it = m_nonSelfLoops.begin(); it.valid(); ++it)
			numEdge[(*m_edgeNums)[*it]] = *it;
		for(int i = 1; i < e_num; i++) {
			e = numEdge[i];
			for(int j = i+1; j <= e_num ; j++) {
				bool cross = intersect(e,numEdge[j]);
				(*m_crossingMatrix)(i,j) = cross;
				if(cross) energySum += 1;
			}
		}
		m_energy = energySum;
	}
开发者ID:SiteView,项目名称:NNMQT,代码行数:21,代码来源:Planarity.cpp


注:本文中的ListIterator::valid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。