/**
	 * @param  $context SecurePoll_Context
	 * @param  $electionTallier SecurePoll_ElectionTallier
	 * @param  $question SecurePoll_Question
	 */
	function __construct( $context, $electionTallier, $question ) {
		parent::__construct( $context, $electionTallier, $question );

		foreach ( $question->getOptions() as $option ) {
			$this->results[$option->getId()] = array();
		}
	}
	function __construct( $context, $electionTallier, $question ) {
		parent::__construct( $context, $electionTallier, $question );
		$this->optionIds = array();
		foreach ( $question->getOptions() as $option ) {
			$this->optionIds[] = $option->getId();
		}

		$this->victories = array();
		foreach ( $this->optionIds as $i ) {
			foreach ( $this->optionIds as $j ) {
				$this->victories[$i][$j] = 0;
			}
		}
	}
	function __construct( $context, $electionTallier, $question ) {
		parent::__construct( $context, $electionTallier, $question );
		$this->minScore = intval( $question->getProperty( 'min-score' ) );
		$this->maxScore = intval( $question->getProperty( 'max-score' ) );
		if ( $this->minScore >= $this->maxScore ) {
			throw new MWException( __METHOD__.': min-score/max-score configured incorrectly' );
		}

		foreach ( $question->getOptions() as $option ) {
			$this->histogram[$option->getId()] = 
				array_fill( $this->minScore, $this->maxScore - $this->minScore + 1, 0 );
			$this->sums[$option->getId()] = 0;
			$this->counts[$option->getId()] = 0;
		}
	}
示例#4
0
	function newTallier( $type, $electionTallier, $question ) {
		return SecurePoll_Tallier::factory( $this, $type, $electionTallier, $question );
	}
	/**
	 * @param  $context SecurePoll_Context
	 * @param  $electionTallier SecurePoll_ElectionTallier
	 * @param  $question SecurePoll_Question
	 */
	function __construct( $context, $electionTallier, $question ) {
		parent::__construct( $context, $electionTallier, $question );
		foreach ( $question->getOptions() as $option ) {
			$this->tally[$option->getId()] = 0;
		}
	}