示例#1
0
bool SynchroObserver::observe(map<string,Group3D*> g3D,map<string,Group2D*> g2D,map<string,Group1D*> g1D, map<string,GroupSwitch*> gs)
{

	bool res = false;
	vector<int>::iterator nit = _timeDoneObserver.begin();
	vector<float>::iterator thit = _thresholds.begin();
	for(vector<Observer*>::iterator oit = _observers.begin();oit != _observers.end();oit++){
		int count = 0;
		(*oit)->observe(g3D,g2D,g1D,gs);

		map<string,float> probas = (*oit)->getProbabilities();
		for(map<string,float>::iterator pit = probas.begin();pit != probas.end();pit++){
			if(pit->second > *thit) count++;
		}

		res = res || (count >= *nit);

		nit++;
		thit++;
	}

	if(res){
		updateProbability("0",1.0);
		_lastProbaOne = _timestamp;
	}
	else{
		if(_timestamp - _lastProbaOne > _timeToSwitch)
			updateProbability("0",0.0);
		else
			updateProbability("0",1.0);
	}

	return true;
}
示例#2
0
void BinomialDistTab::on_nSpinBox_valueChanged(int n) {
  binPlotter->setN(n);
  binPlotter->setXMax(n);
  binPlotter->setXMin(-1);
  binPlotter->update();
  kminSpinBox->setMaximum(n);
  kmaxSpinBox->setMaximum(n);
  updateProbability();
}
示例#3
0
void BinomialDistTab::on_kmaxSpinBox_valueChanged(int) {
  if(kminSpinBox->value() > kmaxSpinBox->value() || joinCheckBox->isChecked())
    kminSpinBox->setValue(kmaxSpinBox->value());

  binPlotter->setKMax(kmaxSpinBox->value());

  updateProbability();
  binPlotter->update();
}
示例#4
0
void BinomialDistTab::on_pDSpinBox_valueChanged(double p) {
  binPlotter->setP(p);
  updateProbability();
  binPlotter->update();
}
示例#5
0
BinomialDistTab::BinomialDistTab(QWidget* parent) : QWidget(parent) {
  setupUi(this);
  binPlotter->setOptions(// Plotter::ZoomFixHorizontal | 
			 Plotter::AutoTicksX | Plotter::AutoTicksY);
  updateProbability();
}