ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAssLacExpressionManufacturer.php
Go to the documentation of this file.
1<?php
2
3include_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) {
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}
An exception for terminatinating execution or to throw for unit testing.
Class AnswerOfCurrentQuestionExpression for the expression R.
Class AnswerOfQuestionExpression for the expression Qn.
Class ExclusiveResultExpression for the expression m,n,o,p
getPattern()
This function create a regular expression to match all expression in a condition.
static _getInstance()
Get an Instance of ExpressionManufacturer.
__clone()
Private clone to prevent cloning an object of ExpressionManufacturer.
manufacture($attribute)
/** Create a new specific Composite object which is representing the delivered Attribute
__construct()
Private constructor to prevent creating of an object of ExpressionManufacturer.
Class MatchingResultExpression for the expression ;n:m;.
Class NumberOfResultExpression fot the expression +n+.
Class NumericResultExpression for the expression #n#.
Class OrderingResultExpression for the expression $a,..,n,m$.
Class PercentageResultExpression for the expression n%.
Class ResultOfAnswerOfCurrentQuestion for the expression R[m].
Class ResultOfAnswerOfQuestion for the expression Qn[m].
Class StringResultExpression for the expression ~TEXT~.