ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAssLacExpressionManufacturer Class Reference

Class ExpressionManufacturer. More...

+ Inheritance diagram for ilAssLacExpressionManufacturer:
+ Collaboration diagram for ilAssLacExpressionManufacturer:

Public Member Functions

 manufacture ($attribute)
 /** Create a new specific Composite object which is representing the delivered Attribute More...
 
 getPattern ()
 This function create a regular expression to match all expression in a condition. More...
 
- Public Member Functions inherited from ilAssLacAbstractManufacturer
 match ($subject)
 Matches a delivered string with a the pattern returned by getPattern implemented in the explicit Manufacturer. More...
 

Static Public Member Functions

static _getInstance ()
 Get an Instance of ExpressionManufacturer. More...
 

Static Protected Attributes

static $instance = null
 

Private Member Functions

 __construct ()
 Private constructor to prevent creating of an object of ExpressionManufacturer. More...
 
 __clone ()
 Private clone to prevent cloning an object of ExpressionManufacturer. More...
 

Detailed Description

Class ExpressionManufacturer.

Date: 25.03.13 Time: 15:12

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

Definition at line 12 of file ilAssLacExpressionManufacturer.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssLacExpressionManufacturer::__construct ( )
private

Private constructor to prevent creating of an object of ExpressionManufacturer.

Definition at line 135 of file ilAssLacExpressionManufacturer.php.

136  {
137  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacAnswerOfQuestionExpression.php";
138  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacAnswerOfCurrentQuestionExpression.php";
139  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacResultOfAnswerOfQuestionExpression.php";
140  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacResultOfAnswerOfCurrentQuestionExpression.php";
141  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacPercentageResultExpression.php";
142  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacNumberOfResultExpression.php";
143  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacNumericResultExpression.php";
144  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacStringResultExpression.php";
145  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacMatchingResultExpression.php";
146  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacOrderingResultExpression.php";
147  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacExclusiveResultExpression.php";
148  require_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacEmptyAnswerExpression.php";
149  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Exception/ilAssLacUnsupportedExpression.php';
150  }

Member Function Documentation

◆ __clone()

ilAssLacExpressionManufacturer::__clone ( )
private

Private clone to prevent cloning an object of ExpressionManufacturer.

Definition at line 155 of file ilAssLacExpressionManufacturer.php.

156  {
157  }

◆ _getInstance()

static ilAssLacExpressionManufacturer::_getInstance ( )
static

Get an Instance of ExpressionManufacturer.

Returns
ilAssLacExpressionManufacturer

Implements ilAssLacManufacturerInterface.

Definition at line 30 of file ilAssLacExpressionManufacturer.php.

Referenced by ilAssLacConditionParser\cannonicalizeCondition(), ilAssLacConditionParser\fetchExpressions(), and ilAssLacCompositeBuilder\getExpression().

31  {
32  if (self::$instance == null) {
33  self::$instance = new ilAssLacExpressionManufacturer();
34  }
35  return self::$instance;
36  }
+ Here is the caller graph for this function:

◆ getPattern()

ilAssLacExpressionManufacturer::getPattern ( )

This function create a regular expression to match all expression in a condition.


The following string is created by this function '/%[0-9]+%|#[0-9]+#|+[0-9]++|Q[0-9]+([^[|0-9]|$)|Q[0-9]+[[0-9]+]|~.*?~'
It matches all expression in a condition and is divided into the following parts:

Qn        /Q[0-9]+(?!\[)/
Qn[m]     /Q[0-9]+\[[0-9]+\]/
n%       /%[0-9]+%/
+n+       /\+[0-9]+\+/
n#       /#[0-9]+#/
~TEXT~    /~.*?~/                               Hier gibt es noch Probleme, wenn im Text ein ~ enthalten ist
Returns
string

Implements ilAssLacManufacturerInterface.

Definition at line 113 of file ilAssLacExpressionManufacturer.php.

References ilAssLacEmptyAnswerExpression\$pattern, ilAssLacAnswerOfCurrentQuestionExpression\$pattern, ilAssLacOrderingResultExpression\$pattern, ilAssLacNumericResultExpression\$pattern, ilAssLacExclusiveResultExpression\$pattern, ilAssLacPercentageResultExpression\$pattern, ilAssLacResultOfAnswerOfCurrentQuestionExpression\$pattern, ilAssLacNumberOfResultExpression\$pattern, ilAssLacMatchingResultExpression\$pattern, ilAssLacStringResultExpression\$pattern, ilAssLacResultOfAnswerOfQuestionExpression\$pattern, and ilAssLacAnswerOfQuestionExpression\$pattern.

114  {
115  return
116  "/" .
129  "/";
130  }

◆ manufacture()

ilAssLacExpressionManufacturer::manufacture (   $attribute)

/** Create a new specific Composite object which is representing the delivered Attribute

Parameters
string$attribute
Returns
ilAssLacAbstractComposite|ilAssLacAnswerOfQuestionExpression|ilAssLacAnswerOfCurrentQuestionExpression|ilAssLacNumberOfResultExpression|ilAssLacNumericResultExpression|ilAssLacPercentageResultExpression|ilAssLacResultOfAnswerOfQuestionExpression|ilAssLacResultOfAnswerOfCurrentQuestionExpression|ilAssLacStringResultExpression
Exceptions
ilAssLacUnsupportedExpression

Implements ilAssLacManufacturerInterface.

Definition at line 47 of file ilAssLacExpressionManufacturer.php.

References ilAssLacEmptyAnswerExpression\$pattern, ilAssLacAnswerOfCurrentQuestionExpression\$pattern, ilAssLacOrderingResultExpression\$pattern, ilAssLacPercentageResultExpression\$pattern, ilAssLacExclusiveResultExpression\$pattern, ilAssLacResultOfAnswerOfCurrentQuestionExpression\$pattern, ilAssLacNumericResultExpression\$pattern, ilAssLacNumberOfResultExpression\$pattern, ilAssLacMatchingResultExpression\$pattern, ilAssLacResultOfAnswerOfQuestionExpression\$pattern, ilAssLacStringResultExpression\$pattern, and ilAssLacAnswerOfQuestionExpression\$pattern.

48  {
49  $expression = null;
50 
51  switch (true) {
52  case preg_match(ilAssLacResultOfAnswerOfQuestionExpression::$pattern, $attribute):
54  break;
57  break;
58  case preg_match(ilAssLacAnswerOfQuestionExpression::$pattern, $attribute):
59  $expression = new ilAssLacAnswerOfQuestionExpression();
60  break;
61  case preg_match(ilAssLacAnswerOfCurrentQuestionExpression::$pattern, $attribute):
63  break;
64  case preg_match(ilAssLacPercentageResultExpression::$pattern, $attribute):
65  $expression = new ilAssLacPercentageResultExpression();
66  break;
67  case preg_match(ilAssLacNumberOfResultExpression::$pattern, $attribute):
68  $expression = new ilAssLacNumberOfResultExpression();
69  break;
70  case preg_match(ilAssLacNumericResultExpression::$pattern, $attribute):
71  $expression = new ilAssLacNumericResultExpression();
72  break;
73  case preg_match(ilAssLacStringResultExpression::$pattern, $attribute):
74  $expression = new ilAssLacStringResultExpression();
75  break;
76  case preg_match(ilAssLacMatchingResultExpression::$pattern, $attribute):
77  $expression = new ilAssLacMatchingResultExpression();
78  break;
79  case preg_match(ilAssLacOrderingResultExpression::$pattern, $attribute):
80  $expression = new ilAssLacOrderingResultExpression();
81  break;
82  case preg_match(ilAssLacExclusiveResultExpression::$pattern, $attribute):
83  $expression = new ilAssLacExclusiveResultExpression();
84  break;
85  case preg_match(ilAssLacEmptyAnswerExpression::$pattern, $attribute):
86  $expression = new ilAssLacEmptyAnswerExpression();
87  break;
88  default:
89  throw new ilAssLacUnsupportedExpression($attribute);
90  break;
91  }
92 
93  $expression->parseValue($attribute);
94  return $expression;
95  }
Class ResultOfAnswerOfCurrentQuestion for the expression R[m].
Class ResultOfAnswerOfQuestion for the expression Qn[m].
Class StringResultExpression for the expression ~TEXT~.
Class AnswerOfCurrentQuestionExpression for the expression R.
Class NumericResultExpression for the expression n#.
Class ExclusiveResultExpression for the expression m,n,o,p
Class AnswerOfQuestionExpression for the expression Qn.
Class MatchingResultExpression for the expression ;n:m;.
Class NumberOfResultExpression fot the expression +n+.
Class PercentageResultExpression for the expression n%.
Class OrderingResultExpression for the expression $a,..,n,m$.

Field Documentation

◆ $instance

ilAssLacExpressionManufacturer::$instance = null
staticprotected

Definition at line 23 of file ilAssLacExpressionManufacturer.php.


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