Exemple #1
0
void PeggingIterator::followPegging
(const OperationPlan* op, double qty, double offset, short lvl)
{
    // Zero quantity operationplans don't have further pegging
    if (!op->getQuantity()) return;

    // For each flowplan ask the buffer to find the pegged operationplans.
    if (downstream)
        for (OperationPlan::FlowPlanIterator i = op->beginFlowPlans();
                i != op->endFlowPlans(); ++i)
        {
            if (i->getQuantity() > ROUNDING_ERROR) // Producing flowplan
                i->getFlow()->getBuffer()->followPegging(*this, &*i, qty, offset, lvl+1);
        }
    else
        for (OperationPlan::FlowPlanIterator i = op->beginFlowPlans();
                i != op->endFlowPlans(); ++i)
        {
            if (i->getQuantity() < -ROUNDING_ERROR) // Consuming flowplan
                i->getFlow()->getBuffer()->followPegging(*this, &*i, qty, offset, lvl+1);
        }

    // Push child operationplans on the stack.
    // The pegged quantity is equal to the ratio of the quantities of the
    // parent and child operationplan.
    for (OperationPlan::iterator j(op); j != OperationPlan::end(); ++j)
        updateStack(
            &*j,
            qty * j->getQuantity() / op->getQuantity(),
            offset * j->getQuantity() / op->getQuantity(),
            lvl+1
        );
}
Exemple #2
0
void DlgTagFetcher::slotNetworkError(int errorCode, QString app) {
    m_networkError = errorCode==0 ?  FTWERROR : HTTPERROR;
    m_data.m_pending = false;
    QString httpStatusMessage = tr("HTTP Status: %1");
    httpStatus->setText(httpStatusMessage.arg(errorCode));
    QString unknownError = tr("Mixxx can't connect to %1 for an unknown reason.");
    cantConnectMessage->setText(unknownError.arg(app));
    QString cantConnect = tr("Mixxx can't connect to %1.");
    cantConnectHttp->setText(cantConnect.arg(app));
    updateStack();
}
Exemple #3
0
PeggingIterator::PeggingIterator(const OperationPlan* opplan, bool b)
    : downstream(b), firstIteration(true), first(false), second_pass(false)
{
    initType(metadata);
    if (!opplan) return;
    if (opplan->getTopOwner()->getOperation()->getType() == *OperationSplit::metadata)
        updateStack(
            opplan,
            opplan->getQuantity(),
            0.0,
            0
        );
    else
        updateStack(
            opplan->getTopOwner(),
            opplan->getTopOwner()->getQuantity(),
            0.0,
            0
        );
}
Exemple #4
0
PeggingIterator::PeggingIterator(LoadPlan* lp, bool b)
    : downstream(b), firstIteration(true), first(false), second_pass(false)
{
    initType(metadata);
    if (!lp) return;
    updateStack(
        lp->getOperationPlan()->getTopOwner(),
        lp->getOperationPlan()->getQuantity(),
        0.0,
        0
    );
}
Exemple #5
0
void DlgTagFetcher::fetchTagFinished(const TrackPointer track,
                                     const QList<TrackPointer>& tracks) {
    // check if the answer is for this track
    if (m_track->getLocation() != track->getLocation()) {
        return;
    }

    m_data.m_pending = false;
    m_data.m_results = tracks;
    // qDebug() << "number of results = " << tracks.size();
    updateStack();
}
Exemple #6
0
DECLARE_EXPORT PeggingIterator::PeggingIterator(FlowPlan* fp, bool b)
  : downstream(b), firstIteration(true), first(false)
{
  initType(metadata);
  if (!fp) return;
  updateStack(
    fp->getOperationPlan()->getTopOwner(),
    fp->getOperationPlan()->getQuantity(),
    0.0,
    0
    );
}
Exemple #7
0
DECLARE_EXPORT PeggingIterator::PeggingIterator(const Demand* d)
  : downstream(false), firstIteration(true), first(false)
{
  initType(metadata);
  const Demand::OperationPlanList &deli = d->getDelivery();
  for (Demand::OperationPlanList::const_iterator opplaniter = deli.begin();
      opplaniter != deli.end(); ++opplaniter)
  {
    OperationPlan *t = (*opplaniter)->getTopOwner();
    updateStack(t, t->getQuantity(), 0.0, 0);
  }
}
Exemple #8
0
void DlgTagFetcher::loadTrack(const TrackPointer track) {
    if (track == NULL) {
        return;
    }
    results->clear();
    m_track = track;
    m_data = Data();
    m_TagFetcher.startFetch(m_track);

    disconnect(this, SLOT(updateTrackMetadata(TrackPointer)));
    connect(track.data(), SIGNAL(changed(TrackInfoObject*)),
            this, SLOT(updateTrackMetadata(TrackInfoObject*)));

    updateStack();
}
    void MessageLabel::setInfoText(const QString & text, bool positive)
    {
        if (positive)
        {
            setObjectName("positive");
        }
        else
        {
            setObjectName("negative");
        }
        this->setStyle(QApplication::style());
        this->setText(text);
        this->show();
        emit updateStack(1);

        _timer.start(8000);
    }
Exemple #10
0
PeggingIterator::PeggingIterator(const Demand* d)
    : downstream(false), firstIteration(true), first(false), second_pass(false)
{
    initType(metadata);
    const Demand::OperationPlanList &deli = d->getDelivery();
    for (Demand::OperationPlanList::const_iterator opplaniter = deli.begin();
            opplaniter != deli.end(); ++opplaniter)
    {
        OperationPlan *t = (*opplaniter)->getTopOwner();
        updateStack(t, t->getQuantity(), 0.0, 0);
    }

    // Bring all pegging information to a second stack.
    // Only in this way can we avoid that the same operationplan is returned
    // multiple times
    while (operator bool())
    {
        /** Check if already found in the vector. */
        bool found = false;
        state& curtop = states.back();
        for (deque<state>::iterator it = states_sorted.begin(); it != states_sorted.end() && !found; ++it)
            if (it->opplan == curtop.opplan)
            {
                // Update existing element in sorted stack
                it->quantity += curtop.quantity;
                if (it->level > curtop.level)
                    it->level = curtop.level;
                found = true;
            }
        if (!found)
            // New element in sorted stack
            states_sorted.push_back( state(curtop.opplan, curtop.quantity, curtop.offset, curtop.level) );

        if (downstream)
            ++*this;
        else
            --*this;
    }

    // The normal iteration will use the sorted results
    second_pass = true;
}
 void MessageLabel::update()
 {
     this->setText("");
     emit updateStack(0);
     this->hide();
 }
Exemple #12
0
void DlgTagFetcher::updateTrackMetadata(TrackInfoObject* pTIO) {
    Q_UNUSED(pTIO);
    updateStack();
}