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


C++ Sequence::append方法代码示例

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


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

示例1: multi_comprehension_filtered_loop_next

static bool multi_comprehension_filtered_loop_next( VMachine* vm )
{
   Sequence* self = dyncast<Sequence*>(vm->local(1)->asGCPointer());

   Item& regA = vm->regA();
   // do the last operation was an oob?
   if( regA.isOob() )
   {
      // is it an integer?
      if( regA.isInteger() )
      {
         // Request to stop?
         if ( regA.asInteger() == 0 )
         {
            vm->retval( vm->self() );
            return false;
         }
         else if ( regA.asInteger() != 1 )
         {
            self->append( vm->regA() );
         }
      }
      else
         self->append( vm->regA() );
   }
   else
      self->append( vm->regA().isString() ? new CoreString( *vm->regA().asString() ) : vm->regA() );

   return multi_comprehension_filtered_loop( vm );
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:30,代码来源:sequence.cpp

示例2: Sequence

/** Build a contig from a branch. */
BranchRecord::operator Sequence() const
{
	assert(!m_data.empty());
	Sequence outseq;
	outseq.reserve(m_data.front().first.length() + m_data.size() - 1);

	if (m_dir == SENSE) {
		BranchData::const_iterator iter = m_data.begin();
		outseq = iter->first.str();
		++iter;
		for (; iter != m_data.end(); ++iter)
			outseq.append(1, iter->first.getLastBaseChar());
	} else {
		BranchData::const_reverse_iterator iter = m_data.rbegin();
		outseq = iter->first.str();
		++iter;
		for (; iter != m_data.rend(); ++iter)
			outseq.append(1, iter->first.getLastBaseChar());
	}
	return outseq;
}
开发者ID:Hensonmw,项目名称:abyss,代码行数:22,代码来源:BranchRecord.cpp

示例3: reverse

Sequence* WordAlphabet::reverse(const Sequence& sequence) const throw (AlphabetMismatchException, Exception)
{
  if ((!hasUniqueAlphabet()) or
      (sequence.getAlphabet()->getAlphabetType() != getAlphabetType()))
    throw AlphabetMismatchException("No matching alphabets");

  Sequence* pseq = new BasicSequence(sequence.getName(), "", getNAlphabet(0));

  size_t s = sequence.size();
  for (size_t i = 0; i < s; i++)
  {
    pseq->append(getPositions(sequence[i]));
  }

  return pseq;
}
开发者ID:prvst,项目名称:Biopp,代码行数:16,代码来源:WordAlphabet.cpp

示例4: multi_comprehension_generate_all

static void multi_comprehension_generate_all( VMachine* vm )
{
   uint32 ssize = vm->currentFrame()->stackSize()-4;
   Sequence* self = dyncast<Sequence*>(vm->local(1)->asGCPointer());

   while( true )
   {
      // create the object to be added.
      CoreArray* cret = new CoreArray( ssize );
      for( uint32 elem = 0; elem < ssize; ++elem )
      {
         Iterator* seq = dyncast<Iterator*>(vm->local(elem+3)->asGCPointer());
         if( ! seq->hasCurrent() )
            return;
         cret->append( seq->getCurrent().isString() ? new CoreString( *seq->getCurrent().asString() ) : seq->getCurrent() );
      }

      // append it
      self->append( cret );

      // advance
      uint32 pos = ssize;
      while( pos > 0 )
      {
         Iterator* seq = dyncast<Iterator*>(vm->local(pos-1+3)->asGCPointer());

         // can we advance?
         if( seq->next() )
            break;

         //--- no? reset this element,
         seq->goTop();
         //--- and advance the previous element.
         --pos;
      }

      // did we reset the topmost element?
      if ( pos == 0)
         break;
   }

   vm->retval( vm->self() );
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:43,代码来源:sequence.cpp

示例5: comp_get_all_items

// gets all the items that it can from a comprehension
static bool comp_get_all_items( VMachine *vm, const Item& cmp )
{
   Sequence* sequence = dyncast<Sequence*>(vm->local(1)->asGCPointer());

   if ( cmp.isRange() )
   {
      if ( cmp.asRangeIsOpen() )
      {
         throw new ParamError( ErrorParam( e_param_range, __LINE__ )
            .origin( e_orig_runtime )
            .extra( "open range" ) );
      }

      int64 start = cmp.asRangeStart();
      int64 end = cmp.asRangeEnd();
      int64 step = cmp.asRangeStep();

      if ( start == end )
      {
         if ( step < 0 )
         {
            sequence->append( start );
         }
         return false; // all done.
      }

      if( start < end )
      {
         if ( step < 0 )
            return true;
         if ( step == 0 )
            step = 1;

         while( start < end )
         {
            sequence->append( start );
            start += step;
         }
      }
      else {
         if ( step > 0 )
            return false;
         if ( step == 0 )
            step = -1;

         while( start >= end )
         {
            sequence->append( start );
            start += step;
         }
      }
   }
   else if ( cmp.isCallable() )
   {
      // change the frame handler, so that instead of having
      vm->returnHandler( comp_get_all_items_callable_next );

      vm->callFrame( cmp, 0 );
      // need more calls.
      return true;
   }
   else if ( cmp.isArray() )
   {
      const CoreArray& arr = *cmp.asArray();
      for( uint32 i = 0; i < arr.length(); i ++ )
      {
         sequence->append( arr[i].isString() ? new CoreString( *arr[i].asString() ) : arr[i] );
      }
   }
   else if ( (cmp.isObject() && cmp.asObjectSafe()->getSequence() ) )
   {
      Sequence* origseq = cmp.asObjectSafe()->getSequence();
      Iterator iter( origseq );
      while( iter.hasCurrent() )
      {
         sequence->append( iter.getCurrent().isString() ? new CoreString( *iter.getCurrent().asString() ) : iter.getCurrent() );
         iter.next();
      }
   }
   else {
      throw new ParamError( ErrorParam( e_inv_params, __LINE__ )
               .origin( e_orig_runtime )
               .extra( "A|C|R|Sequence, [C]" ) );
   }

   // we have processed all the sequence.
   vm->retval( vm->self() );
   return false;
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:90,代码来源:sequence.cpp


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