aboutsummaryrefslogtreecommitdiffstats
path: root/Model/Behavior.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-16 16:15:55 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-16 16:15:55 +0200
commita47252b81b7f6cb207b27fb4ae3f290d0496c3ea (patch)
treef5a1675595d9a04224376c2d67ca00dad0b58420 /Model/Behavior.php
parentc2c368e07a224f7817c033e9a9761ff0241d76ae (diff)
downloadPraspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.zip
Praspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.tar.gz
Praspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.tar.bz2
Introduce collection of clauses.
Clauses can have variables, so that they extend Declaration. But a specification or a behavior can have a collection of other clauses, such as a collection of behavior, represented by an identifier. To build a collection of clauses, we need to instance the Collection class with a preset clause and post-clone function. For each new offset in the collection, the associated value is a clone from the preset clause with the post-clone function applied on this clone. This mechanism allows us to build modular collection of clauses.
Diffstat (limited to 'Model/Behavior.php')
-rw-r--r--Model/Behavior.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/Model/Behavior.php b/Model/Behavior.php
index c31da7f..852d1a7 100644
--- a/Model/Behavior.php
+++ b/Model/Behavior.php
@@ -66,7 +66,12 @@ from('Hoa')
/**
* \Hoa\Praspel\Model\Invariant
*/
--> import('Praspel.Model.Invariant');
+-> import('Praspel.Model.Invariant')
+
+/**
+ * \Hoa\Praspel\Model\Collection
+ */
+-> import('Praspel.Model.Collection');
}
@@ -141,7 +146,15 @@ class Behavior extends Clause {
break;
case 'behavior':
- $handle = new self($this);
+ $handle = new Collection(
+ new self($this),
+ function ( self $clause, $identifier ) {
+
+ $clause->setIdentifier($identifier);
+
+ return;
+ }
+ );
break;
default:
@@ -169,7 +182,6 @@ class Behavior extends Clause {
* Set identifier.
*
* @access public
- * @param string $identifier Identifier.
* @return string
*/
public function setIdentifier ( $identifier ) {