예제 #1
0
파일: 1492.cpp 프로젝트: AiHaibara/acm-icpc
	inline void Adjust(long t) {
		long l1 = Succ(root, t);
		while (true) {
			if (l1 == inf) break;
			long l2 = Succ(root, l1);
			if (l2 == inf) break;
			if (Cross(t, l1, l2) >= 0)
				Delete(l1);
			else break;
			l1 = l2;
		}
		
		l1 = Prev(root, t);
		while (true) {
			if (l1 == inf) break;
			long l2 = Prev(root, l1);
			if (l2 == inf) {
				if (S[t].y > S[l1].y) {
					Delete(l1);
				}
				break;
			}
			if (Cross(l2, l1, t) >= 0 || S[t].y > S[l1].y)
				Delete(l1);
			else break;
			l1 = l2;
		}
	}
예제 #2
0
void Merge(edge *lr, point *s, edge *rl, point *u, edge **tangent) {
	double l1, l2, l3, l4, r1, r2, r3, r4, cot_L, cot_R, u1, v1, u2, v2, n1, cot_n, P1, cot_P;
	point *O, *D, *OR, *OL; edge *B, *L, *R;
	Low_tangent(lr, s, rl, u, &L, &OL, &R, &OR);
	for (*tangent = B = Join(L, OL, R, OR, 0), O = OL, D = OR; ; ) {
		edge *El = Next(B, O), *Er = Prev(B, D), *next, *prev;
		point *l = Other(El, O), *r = Other(Er, D);
		V(l, O, l1, l2); V(l, D, l3, l4); V(r, O, r1, r2); V(r, D, r3, r4);
		double cl = C2(l1, l2, l3, l4), cr = C2(r1, r2, r3, r4);
		bool BL = cl > eps, BR = cr > eps;
		if (!BL && !BR) break;
		if (BL) {
			double dl = Dot(l1, l2, l3, l4);
			for (cot_L = dl / cl; ; Remove(El), El = next, cot_L = cot_n) {
				next = Next(El, O); V(Other(next, O), O, u1, v1); V(Other(next, O), D, u2, v2);
				n1 = C2(u1, v1, u2, v2); if (!(n1 > eps)) break;
				cot_n = Dot(u1, v1, u2, v2) / n1;
				if (cot_n > cot_L) break;
			}
		} if (BR) {
			double dr = Dot(r1, r2, r3, r4);
			for (cot_R = dr / cr; ; Remove(Er), Er = prev, cot_R = cot_P) {
				prev = Prev(Er, D); V(Other(prev, D), O, u1, v1); V(Other(prev, D), D, u2, v2);
				P1 = C2(u1, v1, u2, v2); if (!(P1 > eps)) break;
				cot_P = Dot(u1, v1, u2, v2) / P1;
				if (cot_P > cot_R) break;
			}
		} l = Other(El, O); r = Other(Er, D);
		if (!BL || (BL && BR && cot_R < cot_L)) B = Join(B, O, Er, r, 0), D = r;
		else B = Join(El, l, B, D, 0), O = l;
	}
}
예제 #3
0
파일: object.cpp 프로젝트: paud/d2x-xl
CObject::~CObject ()
{
if (Prev ())
	Prev ()->SetNext (Next ());
if (Next ())
	Next ()->SetPrev (Prev ());
SetPrev (NULL);
SetNext (NULL);
}
예제 #4
0
void
nsGenConList::Insert(nsGenConNode* aNode)
{
  if (mFirstNode) {
    // Check for append.
    if (NodeAfter(aNode, Prev(mFirstNode))) {
      PR_INSERT_BEFORE(aNode, mFirstNode);
    }
    else {
      // Binary search.

      // the range of indices at which |aNode| could end up.
      // (We already know it can't be at index mSize.)
      PRUint32 first = 0, last = mSize - 1;

      // A cursor to avoid walking more than the length of the list.
      nsGenConNode *curNode = Prev(mFirstNode);
      PRUint32 curIndex = mSize - 1;

      while (first != last) {
        PRUint32 test = (first + last) / 2;
        if (last == curIndex) {
          for ( ; curIndex != test; --curIndex)
            curNode = Prev(curNode);
        } else {
          for ( ; curIndex != test; ++curIndex)
            curNode = Next(curNode);
        }

        if (NodeAfter(aNode, curNode)) {
          first = test + 1;
          // if we exit the loop, we need curNode to be right
          ++curIndex;
          curNode = Next(curNode);
        } else {
          last = test;
        }
      }
      PR_INSERT_BEFORE(aNode, curNode);
      if (curNode == mFirstNode) {
        mFirstNode = aNode;
      }
    }
  }
  else {
    // initialize list with first node
    PR_INIT_CLIST(aNode);
    mFirstNode = aNode;
  }
  ++mSize;

  NS_ASSERTION(aNode == mFirstNode || NodeAfter(aNode, Prev(aNode)),
               "sorting error");
  NS_ASSERTION(IsLast(aNode) || NodeAfter(Next(aNode), aNode),
               "sorting error");
}
예제 #5
0
void FramesView::UpdateFrame(FrameView* curr, FrameView* prev,
			     int* curr_others, int num_curr_others,
			     int* prev_others, int num_prev_others) {
  Iterator i;
  First(i);
  FrameView* background = (FrameView*)GetView(i);
  
  if (curr != prev) {
    if (prev) {		
      if (prev != background) prev->Hide();
      prev->Desensitize();
      if (prev_others) {
	for (int np=0; np<num_prev_others; np++) {
	  SetView(prev, i);
	  if (prev_others[np]>0) 
	    for (int ii=0; ii<prev_others[np]; ii++) Next(i);
	  else 
	    for (int ii=0; ii>prev_others[np]; ii--) Prev(i);
	  if (!Done(i)) {
	    FrameView* frame = (FrameView*)GetView(i);
	    if (frame != background) {
	      frame->Hide();
	      frame->Sensitize();
	    }
	  }
	}
      }
    }
    if (curr) {
      if (curr != background) curr->Show();
      curr->Sensitize();
      if (curr_others) {
	for (int np=0; np<num_curr_others; np++) {
	  SetView(curr, i);
	  if (curr_others[np]>0) 
	    for (int ii=0; ii<curr_others[np]; ii++) Next(i);
	  else 
	    for (int ii=0; ii>curr_others[np]; ii--) Prev(i);
	  if (!Done(i)) {
	    FrameView* frame = (FrameView*)GetView(i);
	    if (frame != background) {
	      frame->Show();
	      frame->Desensitize();
	    }
	  }
	}
      }
    }
  }
}
예제 #6
0
파일: list.cpp 프로젝트: mfarin/Task_4
void insertAfter(List &L, address P, address Prec)
{
    if(Prec == Last(L))
    {
        insertLast(L,P);
    }
    else
    {
        Next(P) = Next(Prec);
        Prev(P) = Prec;
        Next(Prec) = P;
        Prev(next(Prec)) = P;
    }
}
예제 #7
0
	inline void solve(void) {
		int Tcase = 0;
		while (scanf("%d%d%d", &N, &C, &D) && !(N == 0 && C == 0 && D == 0)) {
			Tcase++; S.clear(); memset(a, 0, sizeof a);
			memset(f, 0, sizeof f);
			for (int i = 1; i <= N; i++) scanf(LL LL LL LL, &a[i].D, &a[i].P, &a[i].R, &a[i].G);
			sort(a + 1, a + N + 1, cmp); a[0].R = C; a[N + 1].D = D + 1;
			S.insert(Point(0, C));
			for (int i = 1; i <= N + 1; i++) {
				/* force 
				for (int j = 0; j < i; j++) if (f[j] >= a[j].P) {
					f[i] = max(f[i], f[j] - a[j].P + (a[i].D - a[j].D - 1) * a[j].G + a[j].R);
				}
				*/
				Int64 k = -a[i].D;
				set<Point>::iterator it = S.begin();
				while (S.size() >= 2) {
					set<Point>::iterator next = Next(it);
					if ((next->y - it->y) >= k * (next->x - it->x)) {
						S.erase(it);
						it = S.begin();
					} else break;
				}
				f[i] = S.begin()->x * -k + S.begin()->y; if (i == N + 1) break;
				if (f[i] < a[i].P) continue;
				Int64 x = a[i].G, y = -a[i].D * a[i].G - a[i].G + f[i] - a[i].P + a[i].R;
				pair<set<Point>::iterator, bool> t = S.insert(Point(x, y)); it = t.first;
				if (S.size() >= 3 && Next(it) != S.end() && it != S.begin()) {
					set<Point>::iterator prev = Prev(it), next = Next(it);
					if ((next->x - it->x) * (prev->y - it->y) - (next->y - it->y) * (prev->x - it->x) >= 0) {
						S.erase(it);
						continue;
					}
				}
				while (it != S.begin() && Prev(it) != S.begin()) {
					set<Point>::iterator p = Prev(it), pp = Prev(p);
					if ((it->x - p->x) * (pp->y - p->y) - (it->y - p->y) * (pp->x - p->x) >= 0) {
						S.erase(p);
					} else break;
				}
				while (Next(it) != S.end() && Next(Next(it)) != S.end()) {
					set<Point>::iterator p = Next(it), pp = Next(p);
					if ((it->x - p->x) * (pp->y - p->y) - (it->y - p->y) * (pp->x - p->x) <= 0) {
						S.erase(p);
					} else break;
				}
			}
			printf("Case %d: "LL "\n", Tcase, f[N + 1]);
		}
	}
예제 #8
0
파일: list.cpp 프로젝트: mfarin/Task_4
void insertLast(List &L, address P)
{
    if(First(L) == NULL)
    {
        insertFirst(L,P);
    }
    else
    {
        Next(P) = First(L);
        Prev(P) = Last(L);
        Next(Last(L))=P;
        Prev(Last(L)) = P;
        Last(L) = P;
    }
}
예제 #9
0
void DelAfter(List *L,address *Pdel,address Prec) {
/*	I.S. List tidak kosong. Prec adalah anggota list.
	F.S. Menghapus Next(Prec).
	Pdel adalah alamat elemen list yang dihapus */
//Kamus Lokal
	address Pt;
//Algoritma 
	if(Prec==Last(*L)) DelFirst(L,Pdel);
	else if(Prec==Prev(First(*L))) DelLast(L,Pdel);
	else {
		(*Pdel) = Next(Prec);
		Pt = Next(*Pdel);
		Next(Prec) = Pt;
		Prev(Pt) = Prec;
	}
}
예제 #10
0
파일: list.cpp 프로젝트: mfarin/Task_4
void deleteAfter(List &L, address &P, address &Prec)
{   
     if(Prec==NULL) {
        cout<<"Data TIDAK DITEMUKAN"<<endl;
    }
    else if (Prec==First(L)) {
        deleteFirst(L,P);
    }
    else {
    P = Next(Prec);
    Next(Prec) = Next(P);
    Prev(Next(P))=Prec;
    Next(P) = NULL;
    Prev(P) = NULL;
    }
}
예제 #11
0
/*
 * Determines the lower tangent of two triangulations. 
 */
static void lower_tangent(edge * r_cw_l, point * s, edge * l_ccw_r,
                          point * u, edge ** l_lower, point ** org_l_lower,
                          edge ** r_lower, point ** org_r_lower)
{
    edge *l, *r;
    point *o_l, *o_r, *d_l, *d_r;
    boolean finished;

    l = r_cw_l;
    r = l_ccw_r;
    o_l = s;
    d_l = Other_point(l, s);
    o_r = u;
    d_r = Other_point(r, u);
    finished = FALSE;

    while (!finished)
        if (Cross_product_3p(o_l, d_l, o_r) > 0.0) {
            l = Prev(l, d_l);
            o_l = d_l;
            d_l = Other_point(l, o_l);
        } else if (Cross_product_3p(o_r, d_r, o_l) < 0.0) {
            r = Next(r, d_r);
            o_r = d_r;
            d_r = Other_point(r, o_r);
        } else
            finished = TRUE;

    *l_lower = l;
    *r_lower = r;
    *org_l_lower = o_l;
    *org_r_lower = o_r;
}
예제 #12
0
파일: list.hpp 프로젝트: svn2github/staden
T* List<T>::Goto( int n )
{
   assert(n>=0);


   // Check argument
   if( (n<0) || (n>=m_nCount) )
       return 0;


   // Traverse list
   int nDistance = m_nIndex - n;
   if( nDistance < 0 )
   {
      // Traverse forwards
      while( nDistance++ )
         Next();
   }
   else if( nDistance > 0 )
   {
      // Traverse backwards
      while( nDistance-- )
         Prev();
   }
   return m_pCurrent;
}
예제 #13
0
    void PerconaFTIterator::JumpToLast()
    {
        ClearState();
        if (NULL == m_cursor)
        {
            return;
        }
        int ret = 0;
        if (m_iterate_upper_bound_key.GetType() > 0)
        {
            DoJump(m_iterate_upper_bound_key);
            if (!m_valid)
            {
                CHECK_EXPR((ret = m_cursor->c_getf_last(m_cursor, 0, nil_callback, NULL)));
            }
            if (0 == ret)
            {
                Prev();
            }
        }
        else
        {
            CHECK_EXPR((ret = m_cursor->c_getf_last(m_cursor, 0, nil_callback, NULL)));
            if (ret != 0)
            {
                m_valid = false;
                return;
            }
        }

    }
예제 #14
0
파일: macro.cpp 프로젝트: PNCG/neuron
void MacroCmd::Unexecute () {
    Iterator i;

    for (Last(i); !Done(i); Prev(i)) {
        GetCommand(i)->Unexecute();
    }
}
예제 #15
0
void cStreamdevFilters::CarbageCollect(void) {
	LOCK_THREAD;
	for (cStreamdevFilter *fi = First(); fi;) {
		if (fi->IsClosed()) {
			if (errno == ECONNREFUSED ||
					errno == ECONNRESET ||
					errno == EPIPE) {
				ClientSocket.SetFilter(fi->Pid(), fi->Tid(), fi->Mask(), false);
				Dprintf("cStreamdevFilters::CarbageCollector: filter closed: Pid %4d, Tid %3d, Mask %2x (%d filters left)",
						(int)fi->Pid(), (int)fi->Tid(), fi->Mask(), Count()-1);

				cStreamdevFilter *next = Prev(fi);
				Del(fi);
				fi = next ? Next(next) : First();
			} else {
				esyslog("cStreamdevFilters::CarbageCollector() error: "
						"Pid %4d, Tid %3d, Mask %2x (%d filters left) failed",
						(int)fi->Pid(), (int)fi->Tid(), fi->Mask(), Count()-1);
				LOG_ERROR;
				fi = Next(fi);
			}
		} else {
			fi = Next(fi);
		}
	}
}
예제 #16
0
const SimpleNode<T>* ConstListIterator<T>::operator -- (int)
{
  const SimpleNode<T>* RetPtr_ = _ConstHere;
  Prev();

  return RetPtr_;
}
void
nsFilteredContentIterator::Prev()
{
  if (mIsOutOfRange || !mCurrentIterator) {
    NS_ASSERTION(mCurrentIterator, "Missing iterator!");

    return;
  }

  // If we are switching directions then
  // we need to switch how we process the nodes
  if (mDirection != eBackward) {
    nsresult rv = SwitchDirections(false);
    if (NS_FAILED(rv)) {
      return;
    }
  }

  mCurrentIterator->Prev();

  if (mCurrentIterator->IsDone()) {
    return;
  }

  // If we can't get the current node then 
  // don't check to see if we can skip it
  nsINode *currentNode = mCurrentIterator->GetCurrentNode();

  nsCOMPtr<nsIDOMNode> node(do_QueryInterface(currentNode));
  CheckAdvNode(node, mDidSkip, eBackward);
}
예제 #18
0
void PrefsListView::MessageReceived(BMessage *message)
{
	switch(message->what)
	{
		case B_MOUSE_WHEEL_CHANGED:
		{	
			//We have a mouse wheel event when the focus is on the desktop.
			float delta_y;
			if(message->FindFloat("be:wheel_delta_y",&delta_y) == B_OK)
			{				
				//Wrap-Around is taken care of too.
				if(delta_y > 0)       //move wheel down/back
				{
					Next();
				}
				else if(delta_y < 0)	//move wheel up/forward
				{
					Prev();	
				}
			}
						
		}
		break;
		default:
		{	
			BListView::MessageReceived(message);	
		}
		break;
	}
}
예제 #19
0
void Low_tangent(edge *e_l, point *o_l, edge *e_r, point *o_r, edge **l_low, point **OL, edge **r_low, point **OR) {
	for (point *d_l = Other(e_l, o_l), *d_r = Other(e_r, o_r); ; )
		if (C3(o_l, o_r, d_l) < -eps)      e_l = Prev(e_l, d_l), o_l = d_l, d_l = Other(e_l, o_l);
		else if (C3(o_l, o_r, d_r) < -eps) e_r = Next(e_r, d_r), o_r = d_r, d_r = Other(e_r, o_r);
		else break;
	*OL = o_l, *OR = o_r; *l_low = e_l, *r_low = e_r;
}
예제 #20
0
MusicPlayer::MusicPlayer(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MusicPlayer)
{
    ui->setupUi(this);

    Player = new QMediaPlayer(this);
    PlayList = new QMediaPlaylist;

    connect(Player,SIGNAL(positionChanged(qint64)),this,SLOT(PositionChanged(qint64)));
    connect(ui->LengthSlider,SIGNAL(sliderMoved(int)),this,SLOT(SetPosition(int)));
    connect(Player,SIGNAL(durationChanged(qint64)),this,SLOT(DurationChanged(qint64)));
    connect(Player,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),this,SLOT(StatusChanged(QMediaPlayer::MediaStatus)));
    connect(ui->VolumeSlider,SIGNAL(valueChanged(int)),this,SLOT(SetVolume(int)));

    connect(ui->button_start,SIGNAL(released()),this,SLOT(Play()));
    connect(ui->button_stop,SIGNAL(released()),this,SLOT(Stop()));

    connect(ui->button_next,SIGNAL(released()),this,SLOT(Next()));
    connect(ui->button_prev,SIGNAL(released()),this,SLOT(Prev()));

    connect(ui->button_add,SIGNAL(released()),this,SLOT(Add()));
    connect(ui->button_remove,SIGNAL(released()),this,SLOT(Remove()));

    connect(ui->playlist,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(PlaySelected(QModelIndex)));

    connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(SavePlayList()));
    connect(ui->actionLoad,SIGNAL(triggered()),this,SLOT(OpenPlayList()));

    Player->setPlaylist(PlayList);

    ui->VolumeSlider->setRange(0,100);
    ui->VolumeSlider->setValue(100);
}
예제 #21
0
SimpleNode<T>* SimpleListIterator<T>::operator -- (int)
{
  SimpleNode<T>* RetPtr_ = _Here;
  Prev();

  return RetPtr_;
}
예제 #22
0
void
nsCounterList::SetScope(nsCounterNode *aNode)
{
    // This function is responsible for setting |mScopeStart| and
    // |mScopePrev| (whose purpose is described in nsCounterManager.h).
    // We do this by starting from the node immediately preceding
    // |aNode| in content tree order, which is reasonably likely to be
    // the previous element in our scope (or, for a reset, the previous
    // element in the containing scope, which is what we want).  If
    // we're not in the same scope that it is, then it's too deep in the
    // frame tree, so we walk up parent scopes until we find something
    // appropriate.

    if (aNode == First()) {
        aNode->mScopeStart = nullptr;
        aNode->mScopePrev = nullptr;
        return;
    }

    // Get the content node for aNode's rendering object's *parent*,
    // since scope includes siblings, so we want a descendant check on
    // parents.
    nsIContent *nodeContent = aNode->mPseudoFrame->GetContent()->GetParent();

    for (nsCounterNode *prev = Prev(aNode), *start;
         prev; prev = start->mScopePrev) {
        // If |prev| starts a scope (because it's a real or implied
        // reset), we want it as the scope start rather than the start
        // of its enclosing scope.  Otherwise, there's no enclosing
        // scope, so the next thing in prev's scope shares its scope
        // start.
        start = (prev->mType == nsCounterNode::RESET || !prev->mScopeStart)
                  ? prev : prev->mScopeStart;

        // |startContent| is analogous to |nodeContent| (see above).
        nsIContent *startContent = start->mPseudoFrame->GetContent()->GetParent();
        NS_ASSERTION(nodeContent || !startContent,
                     "null check on startContent should be sufficient to "
                     "null check nodeContent as well, since if nodeContent "
                     "is for the root, startContent (which is before it) "
                     "must be too");

             // A reset's outer scope can't be a scope created by a sibling.
        if (!(aNode->mType == nsCounterNode::RESET &&
              nodeContent == startContent) &&
              // everything is inside the root (except the case above,
              // a second reset on the root)
            (!startContent ||
             nsContentUtils::ContentIsDescendantOf(nodeContent,
                                                   startContent))) {
            aNode->mScopeStart = start;
            aNode->mScopePrev  = prev;
            return;
        }
    }

    aNode->mScopeStart = nullptr;
    aNode->mScopePrev  = nullptr;
}
예제 #23
0
StartGame_page_widget::StartGame_page_widget(QWidget *parent) :
    QWidget(parent),
    m_chessBoard(this),
    m_menu(this)
{
    m_chessBoard.StartGame();
    this->setGeometry(0, 0, g_k_windowSize.width(), g_k_windowSize.height());
    //Add ChessBoard
    QVBoxLayout * v_layout = new QVBoxLayout(this);
    v_layout->addWidget(&m_chessBoard);

    //Add horisontal layout for buttons
    QHBoxLayout * h_layout = new QHBoxLayout();
    v_layout->addLayout(h_layout);
    QPushButton * button;

    //Add Save Game Button
    button= new QPushButton("Save Game", this);
    h_layout->addWidget(button);
    this->connect(button, SIGNAL(clicked()), &m_chessBoard, SLOT(Save()));

    //Add Undo Button
    button= new QPushButton("Undo", this);
    h_layout->addWidget(button);
    this->connect(button, SIGNAL(clicked()), &m_chessBoard, SLOT(Prev()));

    //Add horisontal layout for buttons
    h_layout = new QHBoxLayout();
    v_layout->addLayout(h_layout);

    //Add Main menu Button
    button= new QPushButton("Main Menu", this);
    h_layout->addWidget(button);
    this->connect(button, SIGNAL(clicked()), this->parent(), SLOT(InitWelcomePage()));

    //Add Load Game Button
    button= new QPushButton("Load Game", this);
    h_layout->addWidget(button);
    this->connect(button, SIGNAL(clicked()), this->parent(), SLOT(InitLoadGamePage()));

    //Add Empty Chess Board Button
    button= new QPushButton("Empty Chess Board", this);
    h_layout->addWidget(button);
    this->connect(button, SIGNAL(clicked()), this->parent(), SLOT(InitEmptyChessBoardPage()));

    //Add Exit Game Button
    button = new QPushButton("Exit Game", this);
    this->connect(button, SIGNAL(clicked()), this->parent(), SLOT(close()));
    h_layout->addWidget(button);
    m_chessBoard.InitPlayers();
    if (!Logger::isEmpty())
    {
        std::vector<std::pair<Coordinates, Coordinates> > log = Logger::GetLog();
        for (std::vector<std::pair<Coordinates, Coordinates> >::iterator iter = log.begin(); iter != log.end(); ++iter)
        {
            m_chessBoard.SetStepWithKillIfNeed(*iter);
        }
    }
}
예제 #24
0
 Combo(const std::vector<Option> v)
     : options_(v), current_(options_.begin()), selected_(options_.begin()) {
     std::cout << Current().first << "," << Current().second << '\n';
     Prev();
     std::cout << Current().first << "," << Current().second << '\n';
     Next();
     std::cout << Current().first << "," << Current().second << '\n';
 }
예제 #25
0
파일: list.cpp 프로젝트: mfarin/Task_4
address alokasi(infotype x)
{
    address P = new elemenList;
    Info(P) = x;
    Next(P) = NULL;
    Prev(P) = NULL;
    return P;
}
예제 #26
0
void InsertAfter (List *L,address P,address Prec) {
/*	I.S. Prec pastilah elemen list dan bukan elemen terakhir, 
	P sudah dialokasi  
	F.S. Insert P sebagai elemen sesudah elemen beralamat Prec */
	if(FSearch(*L,P))
		printf("Address tidak boleh element dari List yang sudah ada.\n");
	else {
		if(Prec==Last(*L)) InsertLast(L,P);
		else {	
			address Pt = Next(Prec);
			Next(Prec) = P;
			Prev(P) = Prec;
			Next(P) = Pt;
			Prev(Pt) = P;
		}
	}
}
예제 #27
0
boolean PostorderView::Definition (ostream& out) {
    Iterator i;
    boolean ok = true;

    for (Last(i); ok && !Done(i); Prev(i)) {
        ok = GetView(i)->Definition(out);
    }
    return ok;
}
예제 #28
0
void
nsQuoteList::Calc(nsQuoteNode* aNode)
{
  if (aNode == FirstNode()) {
    aNode->mDepthBefore = 0;
  } else {
    aNode->mDepthBefore = Prev(aNode)->DepthAfter();
  }
}
예제 #29
0
ElementType Rear(Queue Q)
{
  if (IsEmpty(Q))
  {
    fprintf(stderr, "Empty Queue\n");
    exit(1);
  }

  return Q -> Next[Prev(Q, Q -> Rear)];
}
예제 #30
0
void DelLast (List *L,address  *P) {
/* I.S. List tidak kosong */
/* F.S. P adalah alamat elemen terakhir sebelum dummy pada list sebelum
penghapusan */
/*Elemen list berkurang satu (mungkin menjadi kosong) */
//Kamus Lokal
	address Pt;
//Algoritma
	(*P) = Last(*L);
	if((*P) == First(*L))
		DelFirst(L,P);
	else {
		Pt = Prev(*P);
		Next(Pt) = First(*L);
		Last(*L) = Pt;
		Pt = First(*L);
		Prev(Pt) = Last(*L);
	}
}