reactive_graph_std_numeric/behaviour/entity/operation/
mod.rs1pub use function::NumericOperationFunction;
2
3pub mod behaviour_f64;
4pub mod behaviour_i64;
5pub mod function;
6
7#[cfg(test)]
8pub mod tests {
9 use reactive_graph_graph::prelude::*;
10 use reactive_graph_reactive_model_impl::ReactiveEntity;
11 use reactive_graph_reactive_model_impl::ReactiveProperties;
12 use serde_json::json;
13 use uuid::Uuid;
14
15 use reactive_graph_std_numeric_model::COMPONENT_NUMERIC_OPERATION;
16 use reactive_graph_std_numeric_model::NumericOperationProperties::LHS;
17 use reactive_graph_std_result_model::COMPONENT_RESULT_NUMBER;
18 use reactive_graph_std_result_model::ResultNumberF64Properties::RESULT;
19
20 pub fn numeric_operation(ty: &EntityTypeId) -> ReactiveEntity {
21 let id = Uuid::new_v4();
22 let properties = PropertyInstances::new().property(LHS, json!(0.0)).property(RESULT, json!(0.0));
23 let components = ComponentTypeIds::new()
24 .component(COMPONENT_NUMERIC_OPERATION.clone())
25 .component(COMPONENT_RESULT_NUMBER.clone());
26
27 ReactiveEntity::builder()
28 .ty(ty)
29 .id(id)
30 .properties(ReactiveProperties::new_with_id_from_properties(id, properties))
31 .components(components)
32 .build()
33 }
34}