ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssLacMatchingResultExpression Class Reference

Class MatchingResultExpression for the expression ;n:m;. 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 = array()
 

Detailed Description

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 13 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 107 of file ilAssLacMatchingResultExpression.php.

108 {
109 $solutions = $result->getSolutions();
110 $isTrue = false;
111 foreach($solutions as $solution)
112 {
113 $isTrue = $isTrue || $this->compare($comperator, $solution["key"], $solution["value"]);
114 }
115 return $isTrue;
116 }
$result

References $result, and 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 125 of file ilAssLacMatchingResultExpression.php.

126 {
127 switch($comperator)
128 {
129 case "=":
130 return $this->getLeftNumericValue() == $left && $this->getRightNumericValue() == $right;
131 break;
132 case "<>":
133 return $this->getLeftNumericValue() != $left || $this->getRightNumericValue() != $right;
134 break;
135 default:
136 return false;
137 }
138 }

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 95 of file ilAssLacMatchingResultExpression.php.

96 {
97 return $this->numeric_value . " beantwortet ";
98 }

◆ getLeftNumericValue()

ilAssLacMatchingResultExpression::getLeftNumericValue ( )
Returns
float

Definition at line 77 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 48 of file ilAssLacMatchingResultExpression.php.

49 {
50 return '/;(\d+):(\d+);/';
51 }

◆ getRightNumericValue()

ilAssLacMatchingResultExpression::getRightNumericValue ( )
Returns
float

Definition at line 69 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 86 of file ilAssLacMatchingResultExpression.php.

87 {
88 return ";" . $this->left_numeric_value. ":" . $this->right_numeric_value . ";";
89 }

◆ 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 60 of file ilAssLacMatchingResultExpression.php.

61 {
62 $this->left_numeric_value = $matches[1][0];
63 $this->right_numeric_value = $matches[2][0];
64 }

Field Documentation

◆ $identifier

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

Definition at line 32 of file ilAssLacMatchingResultExpression.php.

◆ $left_numeric_value

ilAssLacMatchingResultExpression::$left_numeric_value
protected

Definition at line 39 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 46 of file ilAssLacMatchingResultExpression.php.

Referenced by getRightNumericValue().


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