BOOL CChainHeader::Insert(CChainItem* pItem) { if (!m_uNum) { m_pEnd = pItem; m_pHead = pItem; m_pCurrent = pItem; SetNext(pItem); pItem->SetPrevious((CChainItem *)this); pItem->SetNext(NULL); m_uNum ++; }else{ SetNext(pItem); pItem->SetPrevious((CChainItem *)this); pItem->SetNext(m_pHead); m_pHead->SetPrevious(pItem); m_pHead = pItem; m_uNum ++; } pItem->SetHeader(this); return TRUE; }
local void ball_search(smxptr sm, real r2ball, real *ri) { kdnode *ntab = sm->kd->ntab; bodyptr *bptr = sm->kd->bptr; pqnode *pq = sm->pqhead; int cell, cp, ct, pj; real dist2; cell = KDROOT; /* start at root of tree */ while (cell < sm->kd->nsplit) { /* descend to local bucket */ if (ri[ntab[cell].dim] < ntab[cell].split) cell = Lower(cell); else cell = Upper(cell); } for (pj = ntab[cell].first; pj <= ntab[cell].last; ++pj) if (! InQue(bptr[pj])) { /* in bucket, but not que? */ DISTSQV(dist2, ri, Pos(bptr[pj])); /* compute dist^2 to center */ if (dist2 < r2ball) { /* within current ball? */ ClrFlag(bptr[pq->pind], INQUE); /* drop furthest from que */ SetFlag(bptr[pj], INQUE); /* and add this one to que */ pq->pqkey = dist2; /* store its distance */ pq->pind = pj; /* and its index */ PQReplace(pq); /* move to rightful place */ r2ball = pq->pqkey; /* adopt new search radius */ } } while (cell != KDROOT) { /* scan back toward root */ cp = Sibling(cell); ct = cp; SetNext(ct); do { Intersect(ntab[cp], r2ball, ri, GetNextCell); /* got intersection to test */ if (cp < sm->kd->nsplit) { /* not yet down to bucket? */ cp = Lower(cp); continue; } else /* scan bucket for winners */ for (pj = ntab[cp].first; pj <= ntab[cp].last; ++pj) if (! InQue(bptr[pj])) { /* not already in the que? */ DISTSQV(dist2, ri, Pos(bptr[pj])); if (dist2 < r2ball) { /* but within current ball? */ ClrFlag(bptr[pq->pind], INQUE); SetFlag(bptr[pj], INQUE); pq->pqkey = dist2; pq->pind = pj; PQReplace(pq); r2ball = pq->pqkey; } } GetNextCell: SetNext(cp); } while (cp != ct); cell = Parent(cell); /* climb down towards root */ } sm->pqhead = pq; }
void TypePage::OnRadioButton(wxCommandEvent & WXUNUSED(event)) { if (rbOneShot->GetValue()) { // Set the next page to one-shot SetNext(nextOneShot); } else { // Set the next page to evolutionary SetNext(nextEvolutionary); } }
void NassiBricksCompositeIterator::Next() { if ( current ) { if ( itr ) // iterator for childs is created { itr->Next(); if ( itr->IsDone() ) // reached last in chain { delete itr; itr = nullptr; if ( SetItrNextChild() ) //try next in chain { current = itr->CurrentItem(); } else // no more chains found { SetNext(); child = 0; return; } } else // child iterator has a valid item: current = itr->CurrentItem(); } else // itr == 0 { if ( current->GetChildCount() > 0 ) // current->nChilds > 0 ) { currentParent = current; if ( SetItrNextChild() ) //try next in chain { current = itr->CurrentItem(); } else // no more chains found { SetNext(); child = 0; return; } } else { SetNext(); child = 0; return; } } } }
void NassiBricksCompositeIterator::Next() { if ( current ) { if ( itr ) // iterator for childs is created { itr->Next(); if ( itr->IsDone() ) // letztes in kette erreicht { delete itr; itr = (NassiBricksCompositeIterator *)NULL; if ( SetItrNextChild() ) //nächste kette versuchen { current = itr->CurrentItem(); } else // keine kette mehr gefunden { SetNext(); child = 0; return; } } else // child iterator has a valid item: current = itr->CurrentItem(); } else // itr == 0 { if ( current->GetChildCount() > 0 ) // current->nChilds > 0 ) { currentParent = current; if ( SetItrNextChild() ) //nächste kette versuchen { current = itr->CurrentItem(); } else // keine kette mehr gefunden { SetNext(); child = 0; return; } } else { SetNext(); child = 0; return; } } } }
void build_kdtree(kdxptr kd, int nbucket) { int k, n, i, d, m, j, ct; kdnode *ntab; n = kd->ngas; k = 1; while (n > nbucket) { n = n>>1; k = k<<1; } kd->nnode = k<<1; kd->nsplit = k; ntab = kd->ntab = (kdnode *) allocate(kd->nnode * sizeof(kdnode)); ntab[KDROOT].first = 0; /* initialize root node */ ntab[KDROOT].last = kd->ngas-1; ntab[KDROOT].bnd = kd->bnd; i = KDROOT; ct = KDROOT; SetNext(ct); for ( ; ; ) { /* loop splitting nodes */ if (i < kd->nsplit) { d = 0; /* find longest dimension */ for (j=1; j<3; ++j) { if (ntab[i].bnd.maxb[j]-ntab[i].bnd.minb[j] > ntab[i].bnd.maxb[d]-ntab[i].bnd.minb[d]) d = j; } m = median_index(kd->bptr, d, ntab[i].first, ntab[i].last); ntab[i].dim = d; ntab[i].split = Pos(kd->bptr[m])[d]; ntab[Lower(i)].bnd = ntab[i].bnd; ntab[Lower(i)].bnd.maxb[d] = ntab[i].split; ntab[Lower(i)].first = ntab[i].first; ntab[Lower(i)].last = m-1; ntab[Upper(i)].bnd = ntab[i].bnd; ntab[Upper(i)].bnd.minb[d] = ntab[i].split; ntab[Upper(i)].first = m; ntab[Upper(i)].last = ntab[i].last; i = Lower(i); } else { ntab[i].dim = -1; SetNext(i); if (i == ct) break; } } upward_pass(kd, KDROOT); }
local int ball_gather(smxptr sm, real r2ball, real *ri) { kdnode *ntab = sm->kd->ntab; bodyptr *bptr = sm->kd->bptr; int cp, nball, pj; real dist2; nball = 0; cp = KDROOT; do { Intersect(ntab[cp], r2ball, ri, GetNextCell); /* got intersection to test */ if (cp < sm->kd->nsplit) { cp = Lower(cp); continue; } else { for (pj = ntab[cp].first; pj <= ntab[cp].last; ++pj) { DISTSQV(dist2, ri, Pos(bptr[pj])); if (dist2 < r2ball) { sm->r2list[nball] = dist2; sm->inlist[nball++] = pj; } } } GetNextCell: SetNext(cp); } while (cp != KDROOT); if (nball > sm->nsmooth + EXTLIST) error("%s: gathered list overflow\n", getargv0()); return (nball); }
wxInputStream &NassiSwitchBrick::Deserialize(wxInputStream &stream) { wxTextInputStream inp(stream); wxUint32 count; inp >> count; wxString str; wxArrayString arstr; for (wxUint32 n = 0 ; n < 2*count+2 ; n++ ) { DeserializeString( stream, str ); //SetTextByNumber(str, n); arstr.Add(str); } for ( wxUint32 n = 0; n < count ; n++ ) { AddChild(n); SetChild(NassiBrick::SetData(stream), n); } for ( wxUint32 n = 0 ; n < arstr.GetCount() ; n++ ) { SetTextByNumber(arstr[n], n); } SetNext(NassiBrick::SetData(stream)); return stream; }
void CEventCheckerRenderStage::ConstructL(CWsRenderStage* aNextStage) { BaseConstructL(); iGraphicsContextChecker = CGraphicsContextChecker::NewL(iEnv); iSceneChecker = CSceneChecker::NewL(iEnv, iScreen); SetNext(aNextStage); }
BOOL CChainHeader::Add(CChainItem* pItem) { pItem->DisConnect(); // first note if (!m_uNum) { m_pEnd = pItem; m_pHead = pItem; m_pCurrent = pItem; SetNext(pItem); pItem->SetPrevious((CChainItem *)this); pItem->SetNext(NULL); m_uNum ++; }else{ m_pEnd->SetNext(pItem); pItem->SetPrevious(m_pEnd); pItem->SetNext(NULL); m_pEnd = pItem; m_uNum ++; } pItem->SetHeader(this); return TRUE; }
void scContUnit::Unlink( ) { scContUnit* lastPara; scContUnit* nextPara; // mark all the lines of the paragraph as being invalid Deformat( ); lastPara = GetPrev(); nextPara = GetNext(); if ( lastPara ) lastPara->SetNext( nextPara ); else { // this is the first paragraph in the stream and we must let // the columns know that the head of the stream has changed // GetStream()->ResetStream( (scStream*)nextPara ); } if ( nextPara ) nextPara->SetPrev( lastPara ); SetPrev( NULL ); SetNext( NULL ); }
inline void Reader::_SetNext(FILE *aFIn, unsigned char *aCh) { if (!SetNext(aFIn, aCh)) { throw Error("Error in decompression. Perhaps the archive is corrupted"); } }
/** * \brief remove the end of the list, and return it * \returns shared ptr to what was the end of the list */ std::shared_ptr<CSnowflake> CSnowflakeLinkedList::pop() { auto snowflake = GetHead(); if (snowflake != nullptr) { //check if we are already at last node (singly linked list is size 1) if (snowflake->Next() == nullptr) { mStartSnowflake = nullptr; return snowflake; } else { //Get to one before the end while (snowflake->Next()->Next() != nullptr) { snowflake = snowflake->Next(); } auto last = snowflake->Next(); snowflake->SetNext(nullptr); return last; } } else { return nullptr; } }
NassiInstructionBrick::NassiInstructionBrick(const NassiInstructionBrick &rhs): NassiBrick() { Comment = wxString(*(rhs.GetTextByNumber(0))); Source = wxString(*(rhs.GetTextByNumber(1))); if ( rhs.GetNext() ) SetNext( rhs.GetNext()->Clone() ); }
void CRateLimiterRenderStage::ConstructL(CWsRenderStage* aNextStage) { BaseConstructL(); iTick = CPeriodic::NewL(0); SetNext(aNextStage); }
// Delayed initialisation void PageCOM::OnSetActiveDelayed() { // Perform any other initialisation required DFUPage::OnSetActiveDelayed(); // Advance to the next page is automatic behaviour requested if (GetSheet()->automatic) SetNext(); }
NassiReturnBrick::NassiReturnBrick(const NassiReturnBrick &rhs): NassiBrick() { Comment = *(rhs.GetTextByNumber(0)); Source = *(rhs.GetTextByNumber(1)); if ( rhs.GetNext() ) SetNext( rhs.GetNext()->Clone() ); }
wxInputStream &NassiContinueBrick::Deserialize(wxInputStream &stream) { wxTextInputStream inp(stream); wxString str; DeserializeString(stream, str); SetTextByNumber(str, 0); SetNext(NassiBrick::SetData(stream)); return stream; }
CObject::~CObject () { if (Prev ()) Prev ()->SetNext (Next ()); if (Next ()) Next ()->SetPrev (Prev ()); SetPrev (NULL); SetNext (NULL); }
EVENT::~EVENT(void) { // By setting ulNextTime to -1, it will never pass the condition // "pevent->ulNextTime < ulTimeToBeat" in SetNext(). if (peventNext == this) { // are we deleting the next event? ulNextTime = -1; // Yes. Make sure it's not chosen again SetNext(); // Now find another one } }
void WelcomePage::OnchEmptyClick(cb_unused wxCommandEvent& event) { m_Empty = !m_Empty; if( m_Last == NULL) { m_Normal = m_Last = this->GetNext(); if( m_Last != NULL) while( m_Last->GetNext() != NULL) m_Last = m_Last->GetNext(); } if( m_Last != NULL) { if( m_Empty) SetNext( m_Last); else SetNext( m_Normal); } }
XMLAttribute::XMLAttribute(XMLAttribute *prv, char *nam, char *val, XMLAttribute *nxt) { name=value=0; SetName(nam); SetValue(val); SetPrevious(prv); SetNext(nxt); }
NassiDoWhileBrick::NassiDoWhileBrick(const NassiDoWhileBrick &rhs): NassiBrick(), Child(0) { Child = ( NassiBrick * ) 0; for ( wxUint32 n=0 ; n < 2 ; n++ ) SetTextByNumber(*(rhs.GetTextByNumber(n)), n); if ( rhs.GetChild(0) ) Child = rhs.GetChild(0)->Clone(); if ( rhs.GetNext() ) SetNext( rhs.GetNext()->Clone() ); }
XMLTreeNode::XMLTreeNode(XMLTreeNode *prnt, char *typ, char *dta, unsigned int dtaSize, XMLTreeNode *cld, XMLTreeNode *nxt) { attributes=0; type=0; SetType(typ); SetData(dta, dtaSize); SetChild(cld); SetNext(nxt); SetMatchingMode(prnt?prnt->mmode:MATCH_CASE); SetParent(prnt); }
wxInputStream &NassiReturnBrick::Deserialize(wxInputStream &stream) { wxTextInputStream inp(stream); wxString str; for (wxUint32 n = 0 ; n < 2 ; n++ ) { DeserializeString(stream, str); SetTextByNumber(str, n); } SetNext(NassiBrick::SetData(stream)); return stream; }
bool CInformationPanel::CProgramInfoItem::OnButtonPushed(int Button) { switch (Button) { case BUTTON_PREV: case BUTTON_NEXT: SetNext(Button==BUTTON_NEXT); m_pPanel->RedrawButton(GetID(),BUTTON_PREV); m_pPanel->RedrawButton(GetID(),BUTTON_NEXT); return true; } return false; }
void scTBObj::Insert( scTBObj* next ) { scTBObj* prev; scAssert( this && next ); scAssert( Prev() == 0 && Next() == 0 ); if ( ( prev = next->Prev() ) != 0 ) { SetPrev( prev ); prev->SetNext( this ); } next->SetPrev( this ); SetNext( next ); }
NassiSwitchBrick::NassiSwitchBrick(const NassiSwitchBrick &rhs): NassiBrick() { nChilds = 0; for ( wxUint32 k = 0 ; k < rhs.GetChildCount() ; k++ ) { AddChild(k); if ( rhs.GetChild(k) ) SetChild( rhs.GetChild(k)->Clone() , k); } for ( wxUint32 n = 0 ; n < 2 + 2*rhs.GetChildCount() ; n++ ) SetTextByNumber(*(rhs.GetTextByNumber(n)), n); if ( rhs.GetNext() ) SetNext( rhs.GetNext()->Clone() ); }
void scTBObj::Unlink( ) { scTBObj* prev; scTBObj* next; prev = Prev(); next = Next(); if ( prev ) prev->SetNext( next ); if ( next ) next->SetPrev( prev ); SetPrev( 0 ); SetNext( 0 ); }
void scContUnit::PostInsert( scContUnit *p2 ) { scContUnit *nextP; if ( p2 ) { nextP = GetNext( ); SetNext( p2 ); p2->SetPrev( this ); scContUnit* last = (scContUnit*)p2->LastInChain(); last->SetNext( nextP ); if ( nextP ) nextP->SetPrev( last ); Renumber( ); } }