ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 134 of file ilAssLacExpressionManufacturer.php.

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

Member Function Documentation

◆ __clone()

ilAssLacExpressionManufacturer::__clone ( )
private

Private clone to prevent cloning an object of ExpressionManufacturer.

Definition at line 153 of file ilAssLacExpressionManufacturer.php.

153 { }

◆ _getInstance()

static ilAssLacExpressionManufacturer::_getInstance ( )
static

Get an Instance of ExpressionManufacturer.

Returns
ilAssLacExpressionManufacturer

Implements ilAssLacManufacturerInterface.

Definition at line 29 of file ilAssLacExpressionManufacturer.php.

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

30  {
31  if(self::$instance == null){
32  self::$instance = new ilAssLacExpressionManufacturer();
33  }
34  return self::$instance;
35  }
+ 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, ilAssLacResultOfAnswerOfCurrentQuestionExpression\$pattern, ilAssLacExclusiveResultExpression\$pattern, ilAssLacPercentageResultExpression\$pattern, ilAssLacNumberOfResultExpression\$pattern, ilAssLacResultOfAnswerOfQuestionExpression\$pattern, ilAssLacNumericResultExpression\$pattern, ilAssLacStringResultExpression\$pattern, ilAssLacMatchingResultExpression\$pattern, and ilAssLacAnswerOfQuestionExpression\$pattern.

113  {
114  return
115  "/" .
128  "/";
129  }

◆ 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 46 of file ilAssLacExpressionManufacturer.php.

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

47  {
48  $expression = null;
49 
50  switch(true)
51  {
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 22 of file ilAssLacExpressionManufacturer.php.


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