8 : earliestInstantiationTime(earliestInstantiationTime)
9 , latestInstantiationTime(latestInstantiationTime)
13 for (
auto& [attribute, value] : globalValueMap ) {
14 globals[attribute->index] = value;
19 instances[(size_t)instanceId] = {process, (size_t)instanceId, instantiationTime, {}};
23 instances[(size_t)instanceId].values[attribute] = value;
35 std::vector< const Scenario::InstanceData* > result;
36 for (
auto& [
id, instance] :
instances ) {
37 if ( instance.instantiationTime <= currentTime ) {
38 result.push_back(&instance);
46 std::vector< const Scenario::InstanceData* > result;
47 for (
auto& [
id, instance] :
instances ) {
48 result.push_back(&instance);
54 std::vector< std::tuple<const BPMN::Process*, BPMNOS::Values, BPMNOS::Values> > result;
55 for (
auto& [
id, instance] :
instances ) {
56 if ( instance.instantiationTime == currentTime ) {
66 result.push_back(
getKnownValue(instance, attribute.get(), currentTime) );
74 result.push_back(
getKnownValue(instance, attribute.get(), currentTime) );
82 std::vector<double> variableValues;
83 for (
auto input : attribute->
expression->variables ) {
84 if ( !input->isImmutable ) {
88 if ( !value.has_value() ) {
91 variableValues.push_back( (
double)value.value() );
94 std::vector<std::vector<double>> collectionValues;
95 for (
auto input : attribute->
expression->collections ) {
96 if ( !input->isImmutable ) {
99 collectionValues.push_back( {} );
100 auto collection =
getKnownValue(instance, input, currentTime);
101 if ( !collection.has_value() ) {
105 collectionValues.back().push_back( value );
109 return number(attribute->
expression->compiled.evaluate(variableValues, collectionValues));
113 if ( instance->
values.contains(attribute) ) {
114 return instance->
values.at(attribute);
125 auto& instance =
instances.at((
size_t)instanceId);
128 result.push_back(
getKnownValue(&instance, attribute.get(), currentTime) );
134 auto& instance =
instances.at((
size_t)instanceId);
137 result.push_back(
getKnownValue(&instance, attribute.get(), currentTime) );
CollectionRegistry collectionRegistry
std::unique_ptr< const Expression > expression
Class holding extension elements representing execution data for nodes.
std::vector< std::unique_ptr< Attribute > > attributes
Vector containing new status attributes declared for the node.
std::vector< std::unique_ptr< Attribute > > data
Vector containing data attributes declared for data objects within the node's scope.
Represents a BPMN model with all its processes.
std::vector< std::unique_ptr< Attribute > > attributes
Vector containing new global attributes declared for the model.
const Model * model
Pointer to the BPMN model.
std::unordered_map< size_t, InstanceData > instances
std::optional< BPMNOS::number > getKnownValue(const Scenario::InstanceData *instance, const BPMNOS::Model::Attribute *attribute, const BPMNOS::number currentTime) const override
Method returning a known value of an attribute.
std::vector< const InstanceData * > getKnownInstances(const BPMNOS::number currentTime) const override
Method returning a vector of all instances that have been created or are known for sure until the giv...
void setValue(const BPMNOS::number instanceId, const Attribute *attribute, std::optional< BPMNOS::number > value)
std::vector< const InstanceData * > getCreatedInstances(const BPMNOS::number currentTime) const override
Method returning a vector of all instances that have been created until the given time.
void addInstance(const BPMN::Process *process, const BPMNOS::number instanceId, BPMNOS::number instantiationTime)
BPMNOS::number earliestInstantiationTime
std::optional< BPMNOS::Values > getKnownValues(const BPMNOS::number instanceId, const BPMN::Node *node, const BPMNOS::number currentTime) const override
Method returning all known values of new attributes.
BPMNOS::number latestInstantiationTime
std::optional< BPMNOS::Values > getKnownData(const BPMNOS::number instanceId, const BPMN::Node *node, const BPMNOS::number currentTime) const override
Method returning all known values of new attributes.
Values getKnownInitialData(const InstanceData *, const BPMNOS::number time) const override
Method returning the initial data attributes for process instantiation.
bool isCompleted(const BPMNOS::number currentTime) const override
Method returning true if the currentTime exceeds the completion time.
BPMNOS::number getEarliestInstantiationTime() const override
Method returning the time of the earliest instantiation.
StaticScenario(const Model *model, BPMNOS::number earliestInstantiationTime, BPMNOS::number latestInstantiationTime, const std::unordered_map< const Attribute *, BPMNOS::number > &globalValueMap)
std::vector< std::tuple< const BPMN::Process *, BPMNOS::Values, BPMNOS::Values > > getCurrentInstantiations(const BPMNOS::number currentTime) const override
Method returning a vector of all instances that are known to be instantiated at the given time.
Values getKnownInitialStatus(const InstanceData *, const BPMNOS::number time) const override
Method returning the initial status attributes for process instantiation.
std::unique_ptr< ExtensionElements > extensionElements
Base class for all nodes in a BPMN model.
BPMNOS_NUMBER_TYPE number
std::unordered_map< const Attribute *, std::optional< BPMNOS::number > > values
Attribute values.
const BPMN::Process * process