Exemple #1
0
void TGStatVec::PlotAllVsX(const TGStatVal& XVal, const TStr& OutFNm, TStr Desc, const TGpScaleTy& Scale, const bool& PowerFit) const {
  const TFSet SkipStat = TFSet() | gsvFullDiamDev | gsvEffDiamDev | gsvEffWccDiamDev | gsvFullWccDiamDev;
  for (int stat = gsvNone; stat < gsvMx; stat++) {
    const TGStatVal Stat = TGStatVal(stat);
    if (SkipStat.In(Stat)) { continue; }
    if (Last()->HasVal(Stat) && Last()->HasVal(XVal) && Stat!=XVal) {
      Plot(XVal, Stat, OutFNm, Desc, Scale, PowerFit);
    }
  }
}
Exemple #2
0
/** \brief Remember a previous nline-position
*/
void GRVoice::rememberNLinePosition(const TYPE_TIMEPOSITION & tp)
{
    assert(tp == nlinetp);

    GuidoPos pos = Last();
    while (pos && pos != nlinepos)
    {
        GetCompositeElements().RemoveTail();
        pos = Last();
    }
}
Exemple #3
0
void MessageMQ::AppendData(const char* data, uint32_t size) {
  size_t feeds = 0;
  while (feeds < size) {
    if (Last()->Completion()) {
      mq_.push(CreateMessage(msg_type_));
    }
    feeds += Last()->AppendData(&data[feeds], size - feeds);
    if (Last()->Completion()) {
      printf("[MessageMQ] Recieved a complation message, type: %d, size: %lu\n", Last()->Type(), Last()->Size());
    }
  }
}
Exemple #4
0
BOOL CPunktFolge :: AddFolge( CPunktFolge* pP )
{	BOOL	result = FALSE;
	int		i;

//	Sonderfall 1: Die zu addierende Folge ist leer. ==> ignorieren! -------
	if ( pP -> GetSize() == 0 ) return result;

//	Sonderfall 2: Die aufnehmende Folge ist (noch) leer. ==> aufnehmen! ---
	if ( GetSize() == 0 )
	{	result = TRUE;
		for ( i = 0; i < pP -> GetSize(); i++ )
				Add( new CPunkt( *(CPunkt*)(pP -> GetAt( i ))));
		return result;
	}

//	Sonderfall 3: Die zu addierende Folge schließt die Kontur. ------------
//				Wird im folgenden automatisch berücksichtigt! -------------

//	Normalfall: Beide Folgen sind nicht leer. ==> Gemeinsame Endpunkte ----
//				suchen. ---------------------------------------------------
//	Sonderfall 4: Folgen die lediglich aus einem Punkt bestehen werden ----
//				jeweils bei Existenz eines gemeinsamen Endpuktes be- ------
//				rücksichtigt. ---------------------------------------------

	if ( pP -> First() == Last())		// einfach anhängen!
	{	result = TRUE;					// -> erster Punkt in pP fällt unter
		if ( pP -> GetSize() > 1 )		//	  den Tisch!
			for ( i = 1; i < pP -> GetSize(); i++ )
				Add( new CPunkt( *(CPunkt*)(pP -> GetAt( i ))));
	}
	else if ( pP -> Last() == First())	// vorn einfügen
	{	result = TRUE;					// erster Punkt via InsertAt
		if ( pP -> GetSize() > 1 )		// der Rest folgt via SetAt, nur der letzte
		{	InsertAt( 0, new CPunkt( pP -> First()), pP -> GetSize() - 1 );
			for ( i = 1; i <= pP ->	GetSize() - 2; i++ )	// fällt weg!
				SetAt( i, new CPunkt( *(CPunkt*)(pP -> GetAt( i ))));
	}	}
	else if ( pP -> Last() == Last())	// umdrehen und anhängen
	{	result = TRUE;					// -> letzter Punkt wird durch Umdrehen
		if ( pP -> GetSize() > 1 )		//    erster und fällt weg!
			for ( i = pP -> GetSize() - 2; i >= 0; i-- )
				Add( new CPunkt( *(CPunkt*)(pP -> GetAt( i ))));
	}
	else if ( pP -> First() == First())	// umdrehen und vorn einfügen
	{	result = TRUE;					// letzter Punkt via InsertAt
		if ( pP -> GetSize() > 1 )		// der Rest folgt via SetAt, nur der erste
		{	InsertAt( 0, new CPunkt( pP -> Last()), pP -> GetSize() - 1 );
			for ( i = pP ->	GetSize() - 2; i > 0; i-- )	// fällt weg
				SetAt( pP -> GetSize() - i - 1, new CPunkt( *(CPunkt*)(pP -> GetAt( i ))));
	}	}
	return result;
}
YSRESULT YsShellExtEdit_LoopStitching(YsShellExtEdit &shl)
{
	YsShellExt_SingleUseEdgeCondition cond;

	YSRESULT res=YSERR;

	// First deal with a loop hanging on a vertex.
	for(auto vtHd0 : shl.AllVertex())
	{
		auto connVtHd=shl.GetConnectedVertex(vtHd0,cond);
		if(3<=connVtHd.GetN())
		{
			for(auto vtHd1 : connVtHd)
			{
				auto vtLoop=YsShellExt_TrackingUtil::TrackEdge(shl.Conv(),vtHd0,vtHd1,cond);
				if(3<=vtLoop.GetN() && vtLoop[0]==vtLoop.Last())
				{
					YsShellExtEdge_EdgeStaplingUtil stitcher;
					stitcher.SetCrackBoundary(shl.Conv(),vtLoop.GetN()-1,vtLoop);

					if(YSOK==stitcher.StapleMinimumOpenAngleCorner(shl))
					{
						res=YSOK;
					}
				}
			}
		}
	}

	for(auto vtHd0 : shl.AllVertex())
	{
		auto connVtHd=shl.GetConnectedVertex(vtHd0,cond);
		if(2==connVtHd.GetN())
		{
			auto vtLoop=YsShellExt_TrackingUtil::TrackEdge(shl.Conv(),vtHd0,connVtHd[0],cond);
			if(3<=vtLoop.GetN() && vtLoop[0]==vtLoop.Last())
			{
				YsShellExtEdge_EdgeStaplingUtil stitcher;
				stitcher.SetCrackBoundary(shl.Conv(),vtLoop.GetN()-1,vtLoop);

				if(YSOK==stitcher.StapleMinimumOpenAngleCorner(shl))
				{
					res=YSOK;
				}
			}
		}
	}

	return res;
}
Exemple #6
0
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;
    }
}
Exemple #7
0
/** \brief Indicates, that a new system has started.
 	this must be reflected by a new entry into the sysvect.
*/
void GRVoice::startNewSystem(GRSystem * in)
{
    SystemNode * sysnode = new SystemNode();
    sysnode->grsystem = in;
    sysnode->pos = Last();
    mSysNodeList->AddTail(sysnode);
}
Exemple #8
0
RectSelection::RectSelection (Coord l, Coord b, Coord r, Coord t, Graphic* gs)
: (gs) {
    myname = "Rect";
    Append(new IFillRect(l, b, r, t));
    Append(new Rect(l, b, r, t));
}

// RectSelection reads data to initialize its graphic state and create
// its filled interior and outline.

RectSelection::RectSelection (istream& from, State* state) : (nil) {
    myname = "Rect";
    ReadGS(from, state);
    Skip(from);
    Coord l, b, r, t;
    from >> l >> b >> r >> t;
    Append(new IFillRect(l, b, r, t));
    Append(new Rect(l, b, r, t));
}

// Copy returns a copy of the RectSelection.

Graphic* RectSelection::Copy () {
    Coord l, b, r, t;
    GetOriginal2(l, b, r, t);
    return new RectSelection(l, b, r, t, this);
}

// GetOriginal2 returns the two corners that were passed to the
// RectSelection's constructor.

void RectSelection::GetOriginal2 (Coord& l, Coord& b, Coord& r, Coord& t) {
    ((Rect*) Last())->GetOriginal(l, b, r, t);
}
//------------------------------------------------------------
void
nsFilteredContentIterator::Last()
{
  if (!mCurrentIterator) {
    NS_ERROR("Missing iterator!");

    return;
  }

  // If we are switching directions then
  // we need to switch how we process the nodes
  if (mDirection != eBackward) {
    mCurrentIterator = mIterator;
    mDirection       = eBackward;
    mIsOutOfRange    = false;
  }

  mCurrentIterator->Last();

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

  nsINode *currentNode = mCurrentIterator->GetCurrentNode();
  nsCOMPtr<nsIDOMNode> node(do_QueryInterface(currentNode));

  bool didCross;
  CheckAdvNode(node, didCross, eBackward);
}
data_string& data_string::operator=(char * new_string)
{
	if (!new_string)
		throw("Error memory alloc");

	clean_up();

	char *temp = new_string;

	while (*temp++ != '\0') this->size++;

	this->str = new char[this->size + 1];
	if (this->str == NULL)
		throw("Error Alloc memory");

	temp = new_string;
	for (size_t i = 0; i<=this->lenght(); i++)
		this->str[i] = temp[i];

	this->_fill = this->lenght();

	Head(this->str);
	Last(this->str + this->fill());
	Tail(this->str + this->lenght());

	return *this;
}
Exemple #11
0
void AND( ADNFClause dst, ADNFClause src)
{
	ADNFClause newChainEnd;	//the CURRENT tail of the new chain of and clauses
	ADNFClause oldChainI;	//old chain iterator
//	ADNFClause oldCur;
	ADNFClause srcI; //source iterator
	ADNFClause t;	//temp!
	
	oldChainI=dst->next;	//to read the original and clauses from the original linked list
	newChainEnd=dst;	//the head
	newChainEnd->next=0;//empty list for now
	
	while (oldChainI)
	{
		
		for (srcI= src->next; srcI; srcI= srcI->next)	//traverse the other operand to and all the and clauses!
		{
			t=AddClause( newChainEnd, srcI->set | oldChainI->set);	//if it's not added, t=0!
			//Orring two sets means their union, therefore ANDing the and clauses
			
			newChainEnd= (t)? (Last(t)): (newChainEnd);	//if the new clause is not added, it has not deleted anything either
		}
		

		t= oldChainI->next;
		free(oldChainI);
		oldChainI= t;
	}	
	
}
void data_string::resize(const size_t& s)
{
	if (s == 0)
	{
		clean_up();
		return;
	}

	char *cur_temp = this->str;
	size_t old_size = this->size;

	this->size = s;

	this->str = new char[this->size + 1];
	if (this->str == NULL) 
		throw("Error alloc memory");

	for (size_t i = 0; i <= old_size && i < this->lenght(); i++)
		this->str[i] = cur_temp[i]; 
		
	this->_fill = old_size>this->lenght() ? this->lenght() : this->fill();

	this->str[this->fill()] = '\0';
	
	delete[] cur_temp;

	Head(this->str);
	Last(this->str + this->fill());
	Tail(this->str + this->lenght());
}
Exemple #13
0
// Capitalize the first letter of each word.
// Trim leading and trailing non-graphic characters.
// Convert adjacent non-graphic characters a single space.
// Equal-signs (=) are treated as non-graphic characters.
void String::Capitalize(void) {
    bool after_graphic = false;
    String result;
    char const space = ' ';

    for (SizeType i_char = 0; i_char < Length(); i_char++) {
        char ch = at(i_char);
        bool const is_graphic = (::isgraph(ch) != 0 && ch != '=');

        if (!is_graphic) {
            ch = space;
        } else if (!after_graphic) {  // first letter of a word
            ch = char(::toupper(ch));
        }

        if (is_graphic || after_graphic) {
            result += ch;
        }

        after_graphic = is_graphic;
    }

    *this = result;

    if (!IsEmpty() && Last() == space) {
        // remove trailing space, which was originally some non-graphic character
        Shorten(1);
    }
}
void CreateList (List *L)
/* I.S. Sembarang */
/* F.S. Terbentuk list L kosong, dengan satu elemen dummy */
{
	First(*L) = Nil; 
	Last(*L) = Nil;
}
Exemple #15
0
EllipseSelection::EllipseSelection (Coord x0, Coord y0, int rx, int ry,
Graphic* gs) : (gs) {
    Append(new IFillEllipse(x0, y0, rx, ry));
    Append(new Ellipse(x0, y0, rx, ry));
}

// EllipseSelection reads data to initialize its graphic state and
// create its filled interior and outline.

EllipseSelection::EllipseSelection (istream& from, State* state) : (nil) {
    ReadGS(from, state);
    Skip(from);
    Coord x0, y0;
    int rx, ry;
    from >> x0 >> y0 >> rx >> ry;
    Append(new IFillEllipse(x0, y0, rx, ry));
    Append(new Ellipse(x0, y0, rx, ry));
}

// Copy returns a copy of the EllipseSelection.

Graphic* EllipseSelection::Copy () {
    Coord x0, y0;
    int rx, ry;
    GetOriginal(x0, y0, rx, ry);
    return new EllipseSelection(x0, y0, rx, ry, this);
}

// GetOriginal returns the center point and the x and y radii lengths
// that were passed to the EllipseSelection's constructor.

void EllipseSelection::GetOriginal (Coord& x0, Coord& y0, int& rx, int& ry) {
    ((Ellipse*) Last())->GetOriginal(x0, y0, rx, ry);
}
Exemple #16
0
void MacroCmd::Unexecute () {
    Iterator i;

    for (Last(i); !Done(i); Prev(i)) {
        GetCommand(i)->Unexecute();
    }
}
Exemple #17
0
CircleSelection::CircleSelection (Coord x0, Coord y0, int r, Graphic* gs)
: (gs) {
    Append(new IFillCircle(x0, y0, r));
    Append(new Circle(x0, y0, r));
}

// CircleSelection reads data to initialize its graphic state and
// create its filled interior and outline.

CircleSelection::CircleSelection (istream& from, State* state) : (nil) {
    ReadGS(from, state);
    Skip(from);
    Coord x0, y0;
    int r;
    from >> x0 >> y0 >> r;
    Append(new IFillCircle(x0, y0, r));
    Append(new Circle(x0, y0, r));
}

// Copy returns a copy of the CircleSelection.

Graphic* CircleSelection::Copy () {
    Coord x0, y0;
    int r;
    GetOriginal(x0, y0, r);
    return new CircleSelection(x0, y0, r, this);
}

// GetOriginal returns the center point and radius length that were
// passed to the CircleSelection's constructor.

void CircleSelection::GetOriginal (Coord& x0, Coord& y0, int& r) {
    ((Circle*) Last())->GetOriginal(x0, y0, r, r);
}
Exemple #18
0
template <class T> T *List<T>::UnlinkLast (void)
{
	Node<T> *n = Last ();
	if (!n)
		return NULL;
	n->Unlink ();
	return (T *) n;
}
Exemple #19
0
void FName::AddToPath(char *Add)
{
    String S(GetName());
    NewName("");
    AddString(Add);
    if (Last()!='\\') *this << '\\';
    AddString(S);
}
Exemple #20
0
void FName::NewPath(char *p)
{
    String n(GetName());
    Assign(p);
    // force trailing "\\"
    if (!Empty() && Last()!='\\') *this << '\\';
    *this << n;
}
Exemple #21
0
List InitWithArray(int *a, int n)
{
	List L =NULL;
	L = MakeEmpty(L);
	for(int i = 0; i < n; i++){
		Insert(a[i], L, Last(L));
	}
	return L;
}
Exemple #22
0
/* fix: this is slow... */
GLOBAL List *JoinLists(List *list1, List *list2)
{
     List *last = Last(list1);

     if (last == NULL)
	  return list2;
     last->next = list2;
     return (list1);
}
SCH_SCREEN* SCH_SHEET_PATH::LastScreen() const
{
    SCH_SHEET* lastSheet = Last();

    if( lastSheet )
        return lastSheet->GetScreen();

    return NULL;
}
SCH_ITEM* SCH_SHEET_PATH::LastDrawList() const
{
    SCH_SHEET* lastSheet = Last();

    if( lastSheet && lastSheet->GetScreen() )
        return lastSheet->GetScreen()->GetDrawItems();

    return NULL;
}
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;
}
void InsertLast (List *L,address P) {
/* I.S. Sembarang, P sudah dialokasi */
/* F.S. P ditambahkan sebagai elemen terakhir yang baru, */
/*yaitu menjadi elemen sebelum dummy */
	//Kamus Lokal
	address Pt;
	//Algoritma
	if (IsListEmpty(*L)) 
		InsertFirst(L,P);
	else {
		Pt = First(*L);
		Prev(Pt) = P;
		Next(P) = Pt;
		Pt = Last(*L);
		Next(Pt) = P;
		Prev(P) = Pt;
		Last(*L) = P;
	}
}
data_string::data_string(const data_string& obj)
{
	if (*this == obj)
		return;
	*this = obj;

	Head(this->str);
	Last(this->str + this->fill());
	Tail(this->str + this->lenght());
}
 ActivationFactory::ActivationFactory() : ConstructionFactory<Activation*>("Activation") {
     registerConstructor("", fl::null);
     registerConstructor(First().className(), &(First::constructor));
     registerConstructor(General().className(), &(General::constructor));
     registerConstructor(Highest().className(), &(Highest::constructor));
     registerConstructor(Last().className(), &(Last::constructor));
     registerConstructor(Lowest().className(), &(Lowest::constructor));
     registerConstructor(Proportional().className(), &(Proportional::constructor));
     registerConstructor(Threshold().className(), &(Threshold::constructor));
 }
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);
	}
}
void data_string::clean_up()
{
	if (this->str != NULL)
		delete[]this->str;
	this->size = 0;
	this->_fill = 0;

	Head(NULL);
	Last(NULL);
	Tail(NULL);
}