ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

Static Public Attributes

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

Protected Member Functions

 getPattern ()
 
 setMatches ($matches)
 Sets the result of the parsed value by a specific expression pattern. More...
 
- Protected Member Functions inherited from ilAssLacAbstractExpression
 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.

References $result, and compare().

108  {
109  $solutions = $result->getSolutions();
110  $isTrue = false;
111  foreach ($solutions as $solution) {
112  $isTrue = $isTrue || $this->compare($comperator, $solution["key"], $solution["value"]);
113  }
114  return $isTrue;
115  }
$result
+ 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 124 of file ilAssLacMatchingResultExpression.php.

References getLeftNumericValue(), and getRightNumericValue().

Referenced by checkResult().

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

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

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: