ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssLacExpressionManufacturer.php
Go to the documentation of this file.
1<?php
2
3include_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Factory/ilAssLacAbstractManufacturer.php";
4
13
22 protected static $instance = null;
23
29 public static function _getInstance()
30 {
31 if(self::$instance == null){
32 self::$instance = new ilAssLacExpressionManufacturer();
33 }
34 return self::$instance;
35 }
36
46 public function manufacture($attribute)
47 {
48 $expression = null;
49
50 switch(true)
51 {
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 return
115 "/" .
128 "/";
129 }
130
134 private function __construct(){
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 }
149
153 private function __clone() { }
154}
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~.