ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssLacMatchingResultExpression Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAssLacMatchingResultExpression:
+ Collaboration diagram for ilAssLacMatchingResultExpression:

Public Member Functions

 getRightNumericValue ()
 
 getLeftNumericValue ()
 
 getValue ()
 Get the value of this Expression. More...
 
 getDescription ()
 Get a human readable description of the Composite element. More...
 
 checkResult ($result, $comperator, $index=null)
 
- Public Member Functions inherited from ilAssLacAbstractExpression
 parseValue ($value)
 Parses the delivered Value and sets the relevant information for an Expression as attributes. More...
 
- Public Member Functions inherited from ilAssLacAbstractComposite
 addNode (ilAssLacCompositeInterface $node)
 Adds an ilAssLacCompositeInterface object to the node array which represents the condition tree structure. More...
 
 describe ()
 Describes a Composite tree Structure as human readable string. More...
 
 addNode (ilAssLacCompositeInterface $node)
 Adds an CompositeInterface object to the node array which represents the condition tree structure. More...
 
 describe ()
 Describes a Composite tree Structure as human readable string. More...
 
 getDescription ()
 Get a human readable description of the Composite element. More...
 
 getValue ()
 Get the value of this Expression. More...
 
 parseValue ($value)
 Parses the delivered Value and sets the relevant information for an Expression as attributes. More...
 
 checkResult ($result, $comperator, $index=null)
 

Static Public Attributes

static $pattern = "/;[0-9]+:[0-9]+;/"
 
static $identifier = ";n:m;"
 

Protected Member Functions

 getPattern ()
 Get the Pattern to match relevant informations for an Expression. More...
 
 setMatches ($matches)
 Sets the result of the parsed value by a specific expression pattern. More...
 
 getPattern ()
 Get the Pattern to match relevant informations for an Expression. More...
 
 setMatches ($matches)
 Sets the result of the parsed value by a specific expression pattern. More...
 

Protected Attributes

 $left_numeric_value
 
 $right_numeric_value
 

Private Member Functions

 compare ($comperator, $left, $right)
 

Additional Inherited Members

- Data Fields inherited from ilAssLacAbstractComposite
 $nodes = []
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class MatchingResultExpression for the expression ;n:m;

Date: 25.03.13 Time: 16:41

Author
Thomas Joußen tjous.nosp@m.sen@.nosp@m.datab.nosp@m.ay.d.nosp@m.e

Definition at line 26 of file ilAssLacMatchingResultExpression.php.

Member Function Documentation

◆ checkResult()

ilAssLacMatchingResultExpression::checkResult (   $result,
  $comperator,
  $index = null 
)
Parameters
ilUserQuestionResult$result
string$comperator
null | int$index
Returns
bool

Implements ilAssLacSolutionExpressionInterface.

Definition at line 120 of file ilAssLacMatchingResultExpression.php.

120 : bool
121 {
122 $solutions = $result->getSolutions();
123 $isTrue = false;
124 foreach ($solutions as $solution) {
125 $isTrue = $isTrue || $this->compare($comperator, $solution["key"], $solution["value"]);
126 }
127 return $isTrue;
128 }

References compare().

+ Here is the call graph for this function:

◆ compare()

ilAssLacMatchingResultExpression::compare (   $comperator,
  $left,
  $right 
)
private
Parameters
string$comperator
int$left
int$right
Returns
bool

Definition at line 137 of file ilAssLacMatchingResultExpression.php.

137 : bool
138 {
139 switch ($comperator) {
140 case "=":
141 return $this->getLeftNumericValue() == $left && $this->getRightNumericValue() == $right;
142 break;
143 case "<>":
144 return $this->getLeftNumericValue() != $left || $this->getRightNumericValue() != $right;
145 break;
146 default:
147 return false;
148 }
149 }

References getLeftNumericValue(), and getRightNumericValue().

Referenced by checkResult().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilAssLacMatchingResultExpression::getDescription ( )

Get a human readable description of the Composite element.

Returns
string

Implements ilAssLacCompositeInterface.

Definition at line 108 of file ilAssLacMatchingResultExpression.php.

108 : string
109 {
110 return "0 beantwortet ";
111 }

◆ getLeftNumericValue()

ilAssLacMatchingResultExpression::getLeftNumericValue ( )
Returns
float

Definition at line 90 of file ilAssLacMatchingResultExpression.php.

References $left_numeric_value.

Referenced by compare().

+ Here is the caller graph for this function:

◆ getPattern()

ilAssLacMatchingResultExpression::getPattern ( )
protected

Get the Pattern to match relevant informations for an Expression.

Returns
string

Reimplemented from ilAssLacAbstractExpression.

Definition at line 61 of file ilAssLacMatchingResultExpression.php.

61 : string
62 {
63 return '/;(\d+):(\d+);/';
64 }

◆ getRightNumericValue()

ilAssLacMatchingResultExpression::getRightNumericValue ( )
Returns
float

Definition at line 82 of file ilAssLacMatchingResultExpression.php.

References $right_numeric_value.

Referenced by compare().

+ Here is the caller graph for this function:

◆ getValue()

ilAssLacMatchingResultExpression::getValue ( )

Get the value of this Expression.

Returns
string

Implements ilAssLacExpressionInterface.

Definition at line 99 of file ilAssLacMatchingResultExpression.php.

99 : string
100 {
101 return ";" . $this->left_numeric_value . ":" . $this->right_numeric_value . ";";
102 }

◆ setMatches()

ilAssLacMatchingResultExpression::setMatches (   $matches)
protected

Sets the result of the parsed value by a specific expression pattern.

See also
ExpressionInterface::parseValue()
ExpressionInterface::getPattern()
Parameters
array$matches

Reimplemented from ilAssLacAbstractExpression.

Definition at line 73 of file ilAssLacMatchingResultExpression.php.

73 : void
74 {
75 $this->left_numeric_value = $matches[1][0];
76 $this->right_numeric_value = $matches[2][0];
77 }

Field Documentation

◆ $identifier

ilAssLacMatchingResultExpression::$identifier = ";n:m;"
static

Definition at line 45 of file ilAssLacMatchingResultExpression.php.

◆ $left_numeric_value

ilAssLacMatchingResultExpression::$left_numeric_value
protected

Definition at line 52 of file ilAssLacMatchingResultExpression.php.

Referenced by getLeftNumericValue().

◆ $pattern

ilAssLacMatchingResultExpression::$pattern = "/;[0-9]+:[0-9]+;/"
static

◆ $right_numeric_value

ilAssLacMatchingResultExpression::$right_numeric_value
protected

Definition at line 59 of file ilAssLacMatchingResultExpression.php.

Referenced by getRightNumericValue().


The documentation for this class was generated from the following file: