本文整理汇总了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>();
}
}
示例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
示例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
示例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;
}
}
示例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;
}
示例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] ) );
}
}
示例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);
}
示例8:
ClusterGraph::~ClusterGraph()
{
for(ListIterator<ClusterArrayBase*> it = m_regClusterArrays.begin();
it.valid(); ++it)
{
(*it)->disconnect();
}
clear();
}
示例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;
}
}
}
示例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;
}
}
}
示例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
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}