ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilCounterDetector.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3
5require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
6
20{
27
35
41 public function __construct(ilNode $context)
42 {
43 parent::__construct($context);
44 }
45
51 public function setExpectedTriggerEvents($count)
52 {
53 $this->expected_trigger_events = (int) $count;
54 }
55
61 public function getExpectedTriggerEvents()
62 {
64 }
65
72 public function getActualTriggerEvents()
73 {
75 }
76
87 public function setActualTriggerEvents($count)
88 {
89 if ($this->expected_trigger_events < (int) $count)
90 {
91 $this->actual_trigger_events = $count;
92 }
93 else
94 {
95 // TODO: throw actual must be smaller than expected.
96 }
97 }
98
109 public function trigger($params)
110 {
111 if ($this->actual_trigger_events < $this->expected_trigger_events)
112 {
113 $this->actual_trigger_events++;
114 if ($this->actual_trigger_events == $this->expected_trigger_events)
115 {
116 $this->setDetectorState(true);
117 }
118 return true;
119 }
120 return false;
121 }
122}
An exception for terminatinating execution or to throw for unit testing.
@noinspection PhpIncludeInspection
trigger($params)
Trigger this detector.
getExpectedTriggerEvents()
Returns the currently set number of expected trigger events.
setActualTriggerEvents($count)
Sets the actual count of trigger events already taken place.
getActualTriggerEvents()
Returns the actual trigger events of the detector.
setExpectedTriggerEvents($count)
Set the expected trigger event count before the detector is satisfied.
__construct(ilNode $context)
Default constructor, passing the context to the parent constructor.
@noinspection PhpIncludeInspection
setDetectorState($new_state)
Sets a new detector state.
$params
Definition: example_049.php:96
@noinspection PhpIncludeInspection
Definition: ilNode.php:26