示例#1
0
void metricInstance::removeComponent(component *comp) {
  comp->sample->markAsFinished();
  delete (comp);
  
  if (components.size() == 1) {
    sampleVal_cerr << "Last component removed- ";
    // the last component was removed
    // flush aggregate samples
    struct sampleInterval aggSample;
    if(aggregator.aggregate(&aggSample)) {
      relTimeStamp relStartTime = relTimeStamp(aggSample.start - 
					       getEarliestFirstTime());
      relTimeStamp relEndTime = relTimeStamp(aggSample.end - 
					     getEarliestFirstTime());

      assert(relStartTime >= relTimeStamp::Zero());

      assert(relEndTime   >= relStartTime);
      enabledTime += relStartTime - relEndTime;

      sampleVal_cerr << " flush aggregation, start: " << relStartTime 
		     << "  end: " << relEndTime << "  value: " 
		     << aggSample.value << "\n";
      addInterval(relStartTime, relEndTime, aggSample.value);
    }
    if(data) data->flushUnsentBuckets();
    if(global_data) global_data->flushUnsentBuckets();
    flushPerfStreams();
  }
}
示例#2
0
void QMediaTimeRangePrivate::removeInterval(const QMediaTimeInterval &interval)
{
    // Handle normalized intervals only
    if(!interval.isNormal())
        return;

    for (int i = 0; i < intervals.count(); i++) {
        QMediaTimeInterval r = intervals[i];

        if (r.e < interval.s) {
            // Before the removal interval
            continue;
        } else if (interval.e < r.s) {
            // After the removal interval - stop here
            break;
        } else if (r.s < interval.s && interval.e < r.e) {
            // Split case - a single range has a chunk removed
            intervals[i].e = interval.s -1;
            addInterval(QMediaTimeInterval(interval.e + 1, r.e));
            break;
        } else if (r.s < interval.s) {
            // Trimming Tail Case
            intervals[i].e = interval.s - 1;
        } else if (interval.e < r.e) {
            // Trimming Head Case - we can stop after this
            intervals[i].s = interval.e + 1;
            break;
        } else {
            // Complete coverage case
            intervals.removeAt(i);
            --i;
        }
    }
}
示例#3
0
void IntervalList::addIntervalList(const IntervalList& intervals)
{
  const QList<Interval> list = intervals.getList();

  QList<Interval>::const_iterator it = list.constBegin();

  for( ; it != list.constEnd(); ++it)
  {
    addInterval((*it));
  }
}
示例#4
0
void IntervalList::addIntervals(QString intervals)
{
  // Remove whitespace
  intervals = intervals.simplified();
  intervals = intervals.replace(" ", "");
  
  // Split the string, and add the intervals to the list.
  QStringList intervalList = intervals.split(",");
  for(int i = 0; i < intervalList.size(); i++)
  {
    Interval interval(intervalList[i]);
    addInterval(interval);
  }
}
示例#5
0
Animation::Animation(const std::string& caminho, int largura, int altura, int quantX, int quantY){
	texture = TextureManager::carregar(caminho);

	for (int y = 0; y < altura * quantY; y += altura) {
		for (int x = 0; x < largura * quantX; x += largura)
			frames.emplace_back(sf::IntRect(x, y, largura, altura));
	}

	addInterval("allAnimation", 0, frames.size());

	setInterval("allAnimation");
	setAutoAvance(false);
	setHoldTime(1.f);

	frameAt = 0;
}
示例#6
0
/*
 * 完全着地したとき、1が返る(nextに変わる)
 */
int Tetromino::addInterval(Field* f, double d, int* score)
{
	this->interval += d;

	if (this->interval > 15)
	{
		// intervalが15を超えたら1マス下げる
		int land = moveDown(f);

		if (land != 0)
		{
			// 着地していたとき

			if (landing < 0)
			{
				// 初着値なら 0に
//				this->interval = 0;
				landing = 0;
			}
			else
			{
				// 着地済みなら、landingに1を足す
				landing = landing + 1;
			}
			if (landing >= 25)
			{
				//landing が 25を越えたら完全着地
				landed = 1;
				trueDraw(f);
				f->renewField();
				return 1;
			}
		}
		else
		{
			// 着地していないときは、intervalを16で割った余りに
			this->interval = this->interval - 16;
			// landingを初期化
			landing = -1;
			// 得点を1増やす
			(*score) += 1;
			int temp = 0;
			return addInterval(f, 0, &temp);
		}
	}
	return 0;
}
QTransferFunctionEditorByValues::QTransferFunctionEditorByValues(QWidget *parent)
 : QTransferFunctionEditor(parent)
{
    setupUi(this);

    // Creem una scroll area per si hi ha molts intervals (no es pot crear des del Qt Designer)

    QScrollArea *scrollArea = new QScrollArea(this);
    qobject_cast<QBoxLayout*>(this->layout())->insertWidget(1, scrollArea);

    m_intervalEditorsWidget = new QWidget(scrollArea);
    QBoxLayout *layout = new QVBoxLayout(m_intervalEditorsWidget);
    m_intervalEditorsLayout = new QVBoxLayout();
    layout->addLayout(m_intervalEditorsLayout);
    layout->addStretch();
    layout->setMargin(0);

    scrollArea->setWidget(m_intervalEditorsWidget);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);

    // Creem el primer interval

    QTransferFunctionIntervalEditor *first = new QTransferFunctionIntervalEditor(m_intervalEditorsWidget);
    first->setIsFirst(true);
    first->setIsLast(true);
    first->setObjectName("interval0");
    m_intervalEditorsLayout->addWidget(first);

    connect(first, SIGNAL(startChanged(int)), SLOT(markAsChanged()));
    connect(first, SIGNAL(endChanged(int)), SLOT(markAsChanged()));
    connect(first, SIGNAL(colorChanged(const QColor&)), SLOT(markAsChanged()));

    // Mida mínima de la scroll area
    QStyle *style = scrollArea->style();
    int scrollBarWidth = style->pixelMetric(QStyle::PM_ScrollBarExtent);
    scrollArea->setMinimumWidth(first->minimumSizeHint().width() + scrollBarWidth);

    m_numberOfIntervals = 1;

    m_changed = true;

    connect(m_addPushButton, SIGNAL(clicked()), SLOT(addInterval()));
    connect(m_removePushButton, SIGNAL(clicked()), SLOT(removeInterval()));
    connect(m_nameLineEdit, SIGNAL(textChanged(const QString&)), SLOT(markAsChanged()));
}
示例#8
0
void metricInstance::doAggregation() {
  // don't aggregate if this metric is still being enabled (we may 
  // not have received replies for the enable requests from all the daemons)
   if (isCurrentlyEnabling())  return;

  // if we haven't received all of the component start times yet, return
  if(! allComponentStartTimesReceived()) return;


   // update the metric instance sample value if there is a new interval with
  // data for all parts, otherwise this routine returns false
  // and the data cannot be bucketed by the histograms yet (not all
  // components have sent data for this interval)

  struct sampleInterval aggSample;
  while(aggregator.aggregate(&aggSample)) {

    if(getInitialActualValue().isNaN()) {
      setInitialActualValue(aggregator.getInitialActualValue());
    }

    relTimeStamp relStartTime = 
      relTimeStamp(aggSample.start - paradynDaemon::getEarliestStartTime());

 
    relTimeStamp relEndTime = 
      relTimeStamp(aggSample.end - paradynDaemon::getEarliestStartTime());

    assert(relStartTime >= relTimeStamp::Zero());
    
    assert(relEndTime >= relTimeStamp::Zero());
    
    enabledTime += relEndTime - relStartTime;


    sampleVal_cerr << "calling addInterval- st:" << aggSample.start 
		   << "  end: " << aggSample.end << "  val: " 
		   << aggSample.value << "\n";

    addInterval(relStartTime, relEndTime, aggSample.value);
  }
}
示例#9
0
/*!
    \fn QMediaTimeRange::operator+=(const QMediaTimeInterval &interval)

    Adds the specified \a interval to the time range and returns the result.
    \since 1.0
*/
QMediaTimeRange& QMediaTimeRange::operator+=(const QMediaTimeInterval &interval)
{
    addInterval(interval);
    return *this;
}
示例#10
0
void YSelection::addMap( const YSelectionMap& m )
{
    for ( int i = 0; i < m.size(); i++ )
        addInterval( m[ i ] );
}
示例#11
0
YSelection::YSelection( const YInterval& i )
{
    addInterval( i );
}