Exemplo n.º 1
2
/*
 * 	to sort a band, we have
 */
void	band::sortBand (void) {
int	MadeChange = true;
int	i;
/*
 * 	just a simple bubblesort, since the amount of elements
 * 	is limited, and the function is only called on set up
 */
	while (MadeChange) {
	   MadeChange = false;
	   for (i = 0; i < amount - 1; i ++)
	      if (getFrequency (i) > getFrequency (i + 1)) {
	         int f1, v1;
	         f1 = getFrequency (i + 1);
	         v1 = getVoltage   (i + 1);
	         setFrequency (i + 1, getFrequency (i));
	         setVoltage   (i + 1, getVoltage   (i));
	         setFrequency (i, f1);
	         setVoltage   (i, v1);
	         MadeChange = true;
	      }
	}

	setLowerBound (getFrequency (0));
	setUpperBound (getFrequency (amount - 1));
}
Exemplo n.º 2
0
TriangularDistribution::TriangularDistribution(double mode, double lowerBound, double upperBound) 
  : UncertaintyDescription(std::shared_ptr<detail::UncertaintyDescription_Impl>(
        new detail::UncertaintyDescription_Impl(TriangularDistribution::type())))
{
  setMode(mode);
  setLowerBound(lowerBound);
  setUpperBound(upperBound);
}
Exemplo n.º 3
0
BetaDistribution::BetaDistribution(double alpha, double beta, double lowerBound, double upperBound) 
  : UncertaintyDescription(boost::shared_ptr<detail::UncertaintyDescription_Impl>(
        new detail::UncertaintyDescription_Impl(BetaDistribution::type())))
{
  setAlpha(alpha);
  setBeta(beta);
  setLowerBound(lowerBound);
  setUpperBound(upperBound);
}