ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAssLacExpressionManufacturer.php
Go to the documentation of this file.
1 <?php
2 
3 include_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Factory/ilAssLacAbstractManufacturer.php";
4 
13 {
14 
23  protected static $instance = null;
24 
30  public static function _getInstance()
31  {
32  if (self::$instance == null) {
33  self::$instance = new ilAssLacExpressionManufacturer();
34  }
35  return self::$instance;
36  }
37 
47  public function manufacture($attribute)
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  }
96 
113  public function getPattern()
114  {
115  return
116  "/" .
129  "/";
130  }
131 
135  private function __construct()
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  }
151 
155  private function __clone()
156  {
157  }
158 }
Class ResultOfAnswerOfCurrentQuestion for the expression R[m].
Class ResultOfAnswerOfQuestion for the expression Qn[m].
Class StringResultExpression for the expression ~TEXT~.
__construct()
Private constructor to prevent creating of an object of ExpressionManufacturer.
__clone()
Private clone to prevent cloning an object of ExpressionManufacturer.
Class AnswerOfCurrentQuestionExpression for the expression R.
Class NumericResultExpression for the expression n#.
Class ExclusiveResultExpression for the expression m,n,o,p
static _getInstance()
Get an Instance of ExpressionManufacturer.
manufacture($attribute)
/** Create a new specific Composite object which is representing the delivered Attribute ...
Class AnswerOfQuestionExpression for the expression Qn.
Class MatchingResultExpression for the expression ;n:m;.
Class NumberOfResultExpression fot the expression +n+.
getPattern()
This function create a regular expression to match all expression in a condition. ...
Class PercentageResultExpression for the expression n%.
Class OrderingResultExpression for the expression $a,..,n,m$.