ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCaseNode Class Reference

PhpIncludeInspection More...

+ Inheritance diagram for ilCaseNode:
+ Collaboration diagram for ilCaseNode:

Public Member Functions

 __construct (ilWorkflow $context)
 Default constructor. More...
 
 setIsExclusiveJoin ($is_exclusive)
 
 setIsExclusiveFork ($is_exclusive)
 
 activate ()
 Activates the node. More...
 
 deactivate ()
 Deactivates the node. More...
 
 checkTransitionPreconditions ()
 Checks, if the preconditions of the node to transit are met. More...
 
 attemptTransition ()
 Attempts to transit the node. More...
 
 executeTransition ()
 Executes the 'then'-transition of the node. More...
 
 addEmitter (ilEmitter $emitter, $expression='return true;')
 Adds an emitter to one of the lists attached to the node. More...
 
 notifyDetectorSatisfaction (ilDetector $detector)
 This method is called by detectors, that just switched to being satisfied. More...
 
- Public Member Functions inherited from ilBaseNode
 addDetector (ilDetector $detector)
 Adds a detector to the list of detectors. More...
 
 getDetectors ()
 Returns all currently set detectors. More...
 
 addEmitter (ilEmitter $emitter)
 Adds an emitter to the list of emitters. More...
 
 getEmitters ()
 Returns all currently set emitters. More...
 
 addActivity (ilActivity $activity)
 Adds an activity to the list of activities. More...
 
 getActivities ()
 Returns all currently set activities. More...
 
 getContext ()
 Returns a reference to the parent workflow object. More...
 
 setName ($name)
 
 getName ()
 
 getRuntimeVars ()
 
 setRuntimeVars ($runtime_vars)
 
 getRuntimeVar ($name)
 
 setRuntimeVar ($name, $value)
 
 onActivate ()
 Method called on activation of the node. More...
 
 onDeactivate ()
 Method calles on deactivation of the node. More...
 
 isActive ()
 Returns the activation status of the node. More...
 
 attemptTransition ()
 
 checkTransitionPreconditions ()
 
 executeTransition ()
 
 activate ()
 
 deactivate ()
 
 notifyDetectorSatisfaction (ilDetector $detector)
 

Data Fields

 $else_emitters
 
 $is_exclusive
 

Private Attributes

 $is_exclusive_join
 
 $is_exclusive_fork
 

Additional Inherited Members

- Protected Attributes inherited from ilBaseNode
 $context
 
 $detectors
 
 $emitters
 
 $activities
 
 $active = false
 
 $name
 
 $runtime_vars
 

Detailed Description

PhpIncludeInspection

Case node of the petri net based workflow engine.

The case node is a deciding node. It features a multiple set of emitters and no activities.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

/

Definition at line 18 of file class.ilCaseNode.php.

Constructor & Destructor Documentation

◆ __construct()

ilCaseNode::__construct ( ilWorkflow  $context)

Default constructor.

Parameters
ilWorkflow$contextReference to the parent workflow.

Definition at line 37 of file class.ilCaseNode.php.

References ilBaseNode\$context, and array.

38  {
39  $this->context = $context;
40  $this->detectors = array();
41  $this->emitters = array();
42  $this->else_emitters = array();
43  $this->activities = array();
44  $this->is_exclusive = false;
45  }
Create styles array
The data for the language used.

Member Function Documentation

◆ activate()

ilCaseNode::activate ( )

Activates the node.

Implements ilNode.

Definition at line 66 of file class.ilCaseNode.php.

References attemptTransition(), and ilBaseNode\onActivate().

67  {
68  $this->active = true;
69  foreach($this->detectors as $detector)
70  {
71  $detector->onActivate();
72  }
73  $this->onActivate();
74  $this->attemptTransition();
75  }
attemptTransition()
Attempts to transit the node.
onActivate()
Method called on activation of the node.
+ Here is the call graph for this function:

◆ addEmitter()

ilCaseNode::addEmitter ( ilEmitter  $emitter,
  $expression = 'return true;' 
)

Adds an emitter to one of the lists attached to the node.

Parameters
ilEmitter$emitter
boolean$else_emitterTrue, if the emitter should be an 'else'-emitter.

Definition at line 174 of file class.ilCaseNode.php.

References array.

175  {
176  $this->condition_emitter_pairs[] = array(
177  'emitter' => $emitter,
178  'expression' => $expression
179  );
180  }
Create styles array
The data for the language used.

◆ attemptTransition()

ilCaseNode::attemptTransition ( )

Attempts to transit the node.

Basically, this checks for preconditions and transits, returning true or false if preconditions are not met, aka detectors are not fully satisfied.

Returns
boolean True, if transition succeeded.

Implements ilNode.

Definition at line 125 of file class.ilCaseNode.php.

References checkTransitionPreconditions(), and executeTransition().

Referenced by activate(), and notifyDetectorSatisfaction().

126  {
127  if ($this->checkTransitionPreconditions() == true)
128  {
129  $this->executeTransition();
130  return true;
131  }
132  else
133  {
134  return false;
135  }
136  }
checkTransitionPreconditions()
Checks, if the preconditions of the node to transit are met.
executeTransition()
Executes the 'then'-transition of the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTransitionPreconditions()

ilCaseNode::checkTransitionPreconditions ( )

Checks, if the preconditions of the node to transit are met.

Please note, that in a conditional node, this means the node can transit to one or another outcome. This method only returns false, if the return value of the method is neither true nor false.

Returns
boolean True, if node is ready to transit.

Implements ilNode.

Definition at line 99 of file class.ilCaseNode.php.

Referenced by attemptTransition().

100  {
101  // queries the $detectors if their conditions are met.
102  $isPreconditionMet = true;
103  foreach ($this->detectors as $detector)
104  {
105  if ($isPreconditionMet == true)
106  {
107  $isPreconditionMet = $detector->getDetectorState();
108  if($isPreconditionMet && ($this->is_exclusive_join || $this->is_exclusive_fork || $this->is_exclusive))
109  {
110  break;
111  }
112  }
113  }
114  return $isPreconditionMet;
115  }
+ Here is the caller graph for this function:

◆ deactivate()

ilCaseNode::deactivate ( )

Deactivates the node.

Implements ilNode.

Definition at line 80 of file class.ilCaseNode.php.

References ilBaseNode\onDeactivate().

Referenced by executeTransition().

81  {
82  $this->active = false;
83  foreach($this->detectors as $detector)
84  {
85  $detector->onDeactivate();
86  }
87  $this->onDeactivate();
88  }
onDeactivate()
Method calles on deactivation of the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeTransition()

ilCaseNode::executeTransition ( )

Executes the 'then'-transition of the node.

Implements ilNode.

Definition at line 141 of file class.ilCaseNode.php.

References array, and deactivate().

Referenced by attemptTransition().

142  {
143  $this->deactivate();
144  if (count($this->activities) != 0)
145  {
146  foreach ($this->activities as $activity)
147  {
148  $activity->execute();
149  }
150  }
151 
152  foreach((array)$this->condition_emitter_pairs as $pair)
153  {
154  $that = $this;
155  $eval_function = create_function('$that', $pair['expression']);
156  if($eval_function($this->detectors) === true)
157  {
158  $emitter = $pair['emitter'];
159  $emitter->emit();
160  if($this->is_exclusive_fork || $this->is_exclusive_join)
161  {
162  return;
163  }
164  }
165  }
166  }
deactivate()
Deactivates the node.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notifyDetectorSatisfaction()

ilCaseNode::notifyDetectorSatisfaction ( ilDetector  $detector)

This method is called by detectors, that just switched to being satisfied.

Parameters
ilDetector$detectorilDetector which is now satisfied.
Returns
mixed|void

Implements ilNode.

Definition at line 189 of file class.ilCaseNode.php.

References attemptTransition(), and ilBaseNode\isActive().

190  {
191  if ($this->isActive())
192  {
193  $this->attemptTransition();
194  }
195  }
attemptTransition()
Attempts to transit the node.
isActive()
Returns the activation status of the node.
+ Here is the call graph for this function:

◆ setIsExclusiveFork()

ilCaseNode::setIsExclusiveFork (   $is_exclusive)
Parameters
mixed$is_exclusive

Definition at line 58 of file class.ilCaseNode.php.

References $is_exclusive.

59  {
60  $this->is_exclusive_fork = $is_exclusive;
61  }

◆ setIsExclusiveJoin()

ilCaseNode::setIsExclusiveJoin (   $is_exclusive)
Parameters
mixed$is_exclusive

Definition at line 50 of file class.ilCaseNode.php.

References $is_exclusive.

51  {
52  $this->is_exclusive_join = $is_exclusive;
53  }

Field Documentation

◆ $else_emitters

ilCaseNode::$else_emitters

Definition at line 27 of file class.ilCaseNode.php.

◆ $is_exclusive

ilCaseNode::$is_exclusive

Definition at line 30 of file class.ilCaseNode.php.

Referenced by setIsExclusiveFork(), and setIsExclusiveJoin().

◆ $is_exclusive_fork

ilCaseNode::$is_exclusive_fork
private

Definition at line 24 of file class.ilCaseNode.php.

◆ $is_exclusive_join

ilCaseNode::$is_exclusive_join
private

Definition at line 21 of file class.ilCaseNode.php.


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