|
@@ -931,20 +931,16 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "modelling.alh"
|
|
|
include "object_operations.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Make sure that all places have enough tokens
|
|
|
Element links
|
|
|
String link
|
|
|
String place
|
|
|
links = allIncomingAssociationInstances(host_model, name, "P2T")
|
|
|
while (read_nr_out(links) > 0):
|
|
|
link = set_pop(links)
|
|
|
- place = readAssociationSource(host_model, link)
|
|
|
- log("Check link " + link)
|
|
|
- log("Check place " + place)
|
|
|
- if (integer_lt(read_attribute(host_model, place, "tokens"), read_attribute(host_model, link, "weight"))):
|
|
|
- // Not enough tokens for this weight
|
|
|
- return False!
|
|
|
- return True!
|
|
|
+ place = readAssociationSource(host_model, link)
|
|
|
+ if (integer_lt(read_attribute(host_model, place, "tokens"), read_attribute(host_model, link, "weight"))):
|
|
|
+ return False!
|
|
|
+ return True!
|
|
|
$
|
|
|
}
|
|
|
}
|
|
@@ -955,9 +951,9 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- unset_attribute(host_model, name, "executing")
|
|
|
- instantiate_attribute(host_model, name, "executing", True)
|
|
|
- return!
|
|
|
+ unset_attribute(host_model, name, "executing")
|
|
|
+ instantiate_attribute(host_model, name, "executing", True)
|
|
|
+ return!
|
|
|
$
|
|
|
}
|
|
|
}
|
|
@@ -970,8 +966,8 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
+ // Check if this node is executing currently
|
|
|
+ return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
$
|
|
|
}
|
|
|
Pre_Place {
|
|
@@ -980,8 +976,8 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executed"), False)!
|
|
|
+ // Check if this node is executing currently
|
|
|
+ return value_eq(read_attribute(host_model, name, "executed"), False)!
|
|
|
$
|
|
|
}
|
|
|
Pre_P2T {
|
|
@@ -998,15 +994,15 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- Integer tokens
|
|
|
- Integer weight
|
|
|
- tokens = read_attribute(host_model, name, "tokens")
|
|
|
- weight = read_attribute(host_model, mapping["2"], "weight")
|
|
|
- unset_attribute(host_model, name, "tokens")
|
|
|
- instantiate_attribute(host_model, name, "tokens", tokens - weight)
|
|
|
- unset_attribute(host_model, name, "executed")
|
|
|
- instantiate_attribute(host_model, name, "executed", True)
|
|
|
- return!
|
|
|
+ Integer tokens
|
|
|
+ Integer weight
|
|
|
+ tokens = read_attribute(host_model, name, "tokens")
|
|
|
+ weight = read_attribute(host_model, mapping["2"], "weight")
|
|
|
+ unset_attribute(host_model, name, "tokens")
|
|
|
+ instantiate_attribute(host_model, name, "tokens", tokens - weight)
|
|
|
+ unset_attribute(host_model, name, "executed")
|
|
|
+ instantiate_attribute(host_model, name, "executed", True)
|
|
|
+ return!
|
|
|
$
|
|
|
}
|
|
|
Post_P2T {
|
|
@@ -1022,8 +1018,8 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
+ // Check if this node is executing currently
|
|
|
+ return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
$
|
|
|
}
|
|
|
Pre_Place {
|
|
@@ -1032,8 +1028,8 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executed"), False)!
|
|
|
+ // Check if this node is executing currently
|
|
|
+ return value_eq(read_attribute(host_model, name, "executed"), False)!
|
|
|
$
|
|
|
}
|
|
|
Pre_T2P {
|
|
@@ -1050,15 +1046,15 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- Integer tokens
|
|
|
- Integer weight
|
|
|
- tokens = read_attribute(host_model, name, "tokens")
|
|
|
- weight = read_attribute(host_model, mapping["2"], "weight")
|
|
|
- unset_attribute(host_model, name, "tokens")
|
|
|
- instantiate_attribute(host_model, name, "tokens", tokens + weight)
|
|
|
- unset_attribute(host_model, name, "executed")
|
|
|
- instantiate_attribute(host_model, name, "executed", True)
|
|
|
- return!
|
|
|
+ Integer tokens
|
|
|
+ Integer weight
|
|
|
+ tokens = read_attribute(host_model, name, "tokens")
|
|
|
+ weight = read_attribute(host_model, mapping["2"], "weight")
|
|
|
+ unset_attribute(host_model, name, "tokens")
|
|
|
+ instantiate_attribute(host_model, name, "tokens", tokens + weight)
|
|
|
+ unset_attribute(host_model, name, "executed")
|
|
|
+ instantiate_attribute(host_model, name, "executed", True)
|
|
|
+ return!
|
|
|
$
|
|
|
}
|
|
|
Post_T2P {
|
|
@@ -1074,8 +1070,8 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
+ // Check if this node is executing currently
|
|
|
+ return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
$
|
|
|
}
|
|
|
}
|
|
@@ -1086,9 +1082,9 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- unset_attribute(host_model, name, "executingd")
|
|
|
- instantiate_attribute(host_model, name, "executing", False)
|
|
|
- return!
|
|
|
+ unset_attribute(host_model, name, "executingd")
|
|
|
+ instantiate_attribute(host_model, name, "executing", False)
|
|
|
+ return!
|
|
|
$
|
|
|
}
|
|
|
}
|
|
@@ -1101,8 +1097,8 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executed"), True)!
|
|
|
+ // Check if this node is executing currently
|
|
|
+ return value_eq(read_attribute(host_model, name, "executed"), True)!
|
|
|
$
|
|
|
}
|
|
|
}
|
|
@@ -1113,9 +1109,9 @@ Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- unset_attribute(host_model, name, "executed")
|
|
|
- instantiate_attribute(host_model, name, "executed", False)
|
|
|
- return!
|
|
|
+ unset_attribute(host_model, name, "executed")
|
|
|
+ instantiate_attribute(host_model, name, "executed", False)
|
|
|
+ return!
|
|
|
$
|
|
|
}
|
|
|
}
|