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

Class PercentageResultExpression for the expression n%. More...

+ Inheritance diagram for ilAssLacPercentageResultExpression:
+ Collaboration diagram for ilAssLacPercentageResultExpression:

Public Member Functions

 getNumericValue ()
 
 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\.]+%/'
 
static $identifier = "%n%"
 

Protected Member Functions

 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

 $numeric_value
 

Additional Inherited Members

- Data Fields inherited from ilAssLacAbstractComposite
 $nodes = array()
 

Detailed Description

Class PercentageResultExpression for the expression n%.

Date: 25.03.13 Time: 16:40

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

Definition at line 13 of file ilAssLacPercentageResultExpression.php.

Member Function Documentation

◆ checkResult()

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

Implements ilAssLacSolutionExpressionInterface.

Definition at line 85 of file ilAssLacPercentageResultExpression.php.

86 {
87 $percentage = $result->getReachedPercentage();
88 switch($comperator)
89 {
90 case "<":
91 return $percentage < $this->getNumericValue();
92 break;
93 case "<=":
94 return $percentage <= $this->getNumericValue();
95 break;
96 case "=":
97 return $percentage == $this->getNumericValue();
98 break;
99 case ">=":
100 return $percentage >= $this->getNumericValue();
101 break;
102 case ">":
103 return $percentage > $this->getNumericValue();
104 break;
105 case "<>":
106 return $percentage != $this->getNumericValue();
107 break;
108 default:
109 return false;
110 }
111 }
$result

References $result, and getNumericValue().

+ Here is the call graph for this function:

◆ getDescription()

ilAssLacPercentageResultExpression::getDescription ( )

Get a human readable description of the Composite element.

Returns
string

Implements ilAssLacCompositeInterface.

Definition at line 73 of file ilAssLacPercentageResultExpression.php.

74 {
75 return $this->numeric_value . "% beantwortet ";
76 }

◆ getNumericValue()

ilAssLacPercentageResultExpression::getNumericValue ( )
Returns
float

Definition at line 55 of file ilAssLacPercentageResultExpression.php.

References $numeric_value.

Referenced by checkResult().

+ Here is the caller graph for this function:

◆ getValue()

ilAssLacPercentageResultExpression::getValue ( )

Get the value of this Expression.

Returns
string

Implements ilAssLacExpressionInterface.

Definition at line 64 of file ilAssLacPercentageResultExpression.php.

65 {
66 return "%" . $this->numeric_value . "%";
67 }

◆ setMatches()

ilAssLacPercentageResultExpression::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 47 of file ilAssLacPercentageResultExpression.php.

48 {
49 $this->numeric_value = $matches[0][0];
50 }

Field Documentation

◆ $identifier

ilAssLacPercentageResultExpression::$identifier = "%n%"
static

Definition at line 31 of file ilAssLacPercentageResultExpression.php.

◆ $numeric_value

ilAssLacPercentageResultExpression::$numeric_value
protected

Definition at line 38 of file ilAssLacPercentageResultExpression.php.

Referenced by getNumericValue().

◆ $pattern

ilAssLacPercentageResultExpression::$pattern = '/%[0-9\.]+%/'
static

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