public function __construct(ExpressionCollection $expressions)
 {
     parent::__construct($expressions, 2, 2, array(OperatorCardinality::SINGLE), array(OperatorBaseType::INTEGER, OperatorBaseType::FLOAT));
 }
 /**
  * Create a new instance of StatsOperator.
  * 
  * @param ExpressionCollection $expressions A collection of Expression objects.
  * @param integer $name A value from the Statistics enumeration.
  * @throws InvalidArgumentException If $name is not a value from the Statistics enumeration or if the count of $expressions is greather than 1.
  */
 public function __construct(ExpressionCollection $expressions, $name)
 {
     parent::__construct($expressions, 1, 1, array(Cardinality::MULTIPLE, Cardinality::ORDERED), array(OperatorBaseType::INTEGER, OperatorBaseType::FLOAT));
     $this->setName($name);
 }
Beispiel #3
0
 /**
  * Create a new Multiple object.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions
  */
 public function __construct(ExpressionCollection $expressions)
 {
     parent::__construct($expressions, 0, -1, array(Cardinality::SINGLE, Cardinality::MULTIPLE), array(OperatorBaseType::SAME));
 }
Beispiel #4
0
 /**
  * Create a new PatternMatch object.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions A collection of Expression objects.
  * @param string $pattern A pattern to match or a variable reference.
  * @throws \InvalidArgumentException If $pattern is not a string value or if the $expressions count exceeds 1.
  */
 public function __construct(ExpressionCollection $expressions, $pattern)
 {
     parent::__construct($expressions, 1, 1, array(OperatorCardinality::SINGLE), array(OperatorBaseType::STRING));
     $this->setPattern($pattern);
 }
Beispiel #5
0
 /**
  * Create a new Inside object.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions A collection of Expression objects.
  * @param int $shape A value from the Shape enumeration
  * @param \qtism\common\datatypes\Coords $coords A Coords object as the size and position of the area, interpreted in conjunction with $shape.
  * @throws \InvalidArgumentException If the $expressions count exceeds 1 or if $shape is not a value from the Shape enumeration.
  */
 public function __construct(ExpressionCollection $expressions, $shape, Coords $coords)
 {
     parent::__construct($expressions, 1, 1, array(OperatorCardinality::SINGLE, OperatorCardinality::MULTIPLE, OperatorCardinality::ORDERED), array(OperatorBaseType::POINT));
     $this->setShape($shape);
     $this->setCoords($coords);
 }
 /**
  * Create a new EqualRounded object.
  * 
  * @param ExpressionCollection $expressions A collection of Expression objects.
  * @param string|integer $figures The number of figures to round to. It must be an integer or a variable reference. 
  * @param integer $roundingMode A value from the RoundingMode enumeration.
  * @throws InvalidArgumentException If $figures is not an integer nor a variable reference, if $roundingMode is not a value from the RoundingMode enumeration, or if the $expressions count exceeds 2.
  */
 public function __construct(ExpressionCollection $expressions, $figures, $roundingMode = RoundingMode::SIGNIFICANT_FIGURES)
 {
     parent::__construct($expressions, 2, 2, array(OperatorCardinality::SINGLE), array(OperatorBaseType::INTEGER, OperatorBaseType::FLOAT));
     $this->setFigures($figures);
     $this->setRoundingMode($roundingMode);
 }
Beispiel #7
0
 /**
  * Create a new Random object.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions
  */
 public function __construct(ExpressionCollection $expressions)
 {
     parent::__construct($expressions, 1, 1, array(OperatorCardinality::MULTIPLE, OperatorCardinality::ORDERED), array(OperatorBaseType::ANY));
 }
Beispiel #8
0
 /**
  * Create a new instance of AnyN.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions A collection of Expression objects.
  * @param string|integer $min An integer or a variable reference.
  * @param string|integer $max An integer or a variable reference.
  */
 public function __construct(ExpressionCollection $expressions, $min, $max)
 {
     parent::__construct($expressions, 1, -1, array(Cardinality::SINGLE), array(OperatorBaseType::BOOLEAN));
     $this->setMin($min);
     $this->setMax($max);
 }
Beispiel #9
0
 /**
  * Create a new Index.
  *
  * @param ExpressionCollection $expressions A collection of Expression objects.
  * @param integer $n The index to lookup. It must be an integer or a variable reference.
  * @throws \InvalidArgumentException If $n is not an integer nor a variable reference.
  */
 public function __construct(ExpressionCollection $expressions, $n)
 {
     parent::__construct($expressions, 1, 1, array(OperatorCardinality::ORDERED), array(OperatorBaseType::ANY));
     $this->setN($n);
 }
 /**
  * Create a new instance of FieldValue.
  * 
  * @param ExpressionCollection $expressions A collection of Expression objects.
  * @param string $fieldIdentifier A QTI Identifier.
  */
 public function __construct(ExpressionCollection $expressions, $fieldIdentifier)
 {
     parent::__construct($expressions, 1, 1, array(OperatorCardinality::RECORD), array(OperatorBaseType::ANY));
     $this->setFieldIdentifier($fieldIdentifier);
 }
 public function __construct(ExpressionCollection $expressions)
 {
     parent::__construct($expressions, 2, 2, array(OperatorCardinality::SAME), array(OperatorCardinality::SAME));
 }
 public function __construct(ExpressionCollection $expressions, $xmlString)
 {
     parent::__construct($expressions, 0, -1, array(OperatorCardinality::ANY), array(OperatorBaseType::ANY));
     $this->setXmlString($xmlString);
     $this->setExternalComponent(new ExternalQtiComponent($xmlString));
 }
Beispiel #13
0
 /**
  * Create a new Equal object.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions A collection of Expression objects.
  * @param integer $toleranceMode The tolerance mode, a value from the ToleranceMode enumeration.
  * @param array $tolerance An array of 1 or 2 elements which are float or variableRef values.
  * @param boolean $includeLowerBound Whether or not to include the lower bound in the comparison.
  * @param boolean $includeUpperBound Whether or not to include the upper bound in the comparison.
  * @throws \UnexpectedValueException If The tolerance argument is ABSOLUTE or RELATIVE but no $tolerance array is given.
  * @throws \InvalidArgumentException If $toleranceMode is not a value from the ToleranceMode, if $tolerance is not a valid tolerance array, if $includeLowerBound/$includeUpperBound is not a boolean.
  */
 public function __construct(ExpressionCollection $expressions, $toleranceMode = ToleranceMode::EXACT, $tolerance = array(), $includeLowerBound = true, $includeUpperBound = true)
 {
     parent::__construct($expressions, 2, 2, array(OperatorCardinality::SINGLE), array(OperatorBaseType::INTEGER, OperatorBaseType::FLOAT));
     $this->setToleranceMode($toleranceMode);
     if (($this->getToleranceMode() == ToleranceMode::ABSOLUTE || $this->getToleranceMode() == ToleranceMode::RELATIVE) && empty($tolerance)) {
         $msg = "The tolerance argument must be specified when ToleranceMode = ABSOLUTE or EXACT.";
         throw new UnexpectedValueException($msg);
     }
     $this->setTolerance($tolerance);
     $this->setIncludeLowerBound($includeLowerBound);
     $this->setIncludeUpperBound($includeUpperBound);
 }
Beispiel #14
0
 /**
  * Create a new OrOperator object.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions
  */
 public function __construct(ExpressionCollection $expressions)
 {
     parent::__construct($expressions, 1, -1, array(OperatorCardinality::SINGLE), array(OperatorBaseType::BOOLEAN));
 }
 /**
  * Create a new instance of StringMatch.
  * 
  * @param ExpressionCollection $expressions A collection of Expression objects.
  * @param boolean $caseSensitive Whether or not the match to be carried out case sensitively.
  * @param boolean $substring Deprecated argument, use the substring operator instead.
  * @throws InvalidArgumentException If $caseSensitive or $substring are not booleans or if the $expressions count is greather than 2.
  */
 public function __construct(ExpressionCollection $expressions, $caseSensitive, $substring = false)
 {
     parent::__construct($expressions, 2, 2, array(OperatorCardinality::SINGLE), array(OperatorBaseType::STRING));
     $this->setCaseSensitive($caseSensitive);
     $this->setSubstring($substring);
 }
 public function __construct(ExpressionCollection $expressions)
 {
     parent::__construct($expressions, 1, -1, array(OperatorCardinality::SINGLE, OperatorCardinality::MULTIPLE, OperatorCardinality::ORDERED), array(OperatorBaseType::INTEGER, OperatorBaseType::FLOAT));
 }
Beispiel #17
0
 /**
  * Create a new instance of Repeat.
  *
  * @param \qtism\data\expressions\ExpressionCollection $expressions A collection of Expression objects.
  * @param integer $numberRepeats An integer or a QTI variable reference.
  */
 public function __construct(ExpressionCollection $expressions, $numberRepeats)
 {
     parent::__construct($expressions, 1, -1, array(Cardinality::SINGLE, Cardinality::ORDERED), array(OperatorBaseType::SAME));
     $this->setNumberRepeats($numberRepeats);
 }