1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use crate::aggregate_state::model::{AggregateMarking, AggregateState, AggregateType, SilentAggregateSystem, SilentEntitySystem};
use crate::enumerations::{AggregateStateAggregateState, AggregateStateFormation, ForceId};
use crate::model::{EntityId, Location, Orientation, VariableDatum, VectorF32};

pub struct AggregateStateBuilder(AggregateState);

impl AggregateStateBuilder {
    pub fn new() -> Self {
        AggregateStateBuilder(AggregateState::default())
    }

    pub fn new_from_body(body: AggregateState) -> Self {
        AggregateStateBuilder(body)
    }

    pub fn build(self) -> AggregateState {
        self.0
    }

    pub fn with_aggregate_id(mut self, aggregate_id: EntityId) -> Self {
        self.0.aggregate_id = aggregate_id;
        self
    }

    pub fn with_force_id(mut self, force_id: ForceId) -> Self {
        self.0.force_id = force_id;
        self
    }

    pub fn with_aggregate_state(mut self, aggregate_state: AggregateStateAggregateState) -> Self {
        self.0.aggregate_state = aggregate_state;
        self
    }

    pub fn with_aggregate_type(mut self, aggregate_type: AggregateType) -> Self {
        self.0.aggregate_type = aggregate_type;
        self
    }

    pub fn with_formation(mut self, formation: AggregateStateFormation) -> Self {
        self.0.formation = formation;
        self
    }

    pub fn with_aggregate_marking(mut self, aggregate_marking: AggregateMarking) -> Self {
        self.0.aggregate_marking = aggregate_marking;
        self
    }

    pub fn with_dimensions(mut self, dimensions: VectorF32) -> Self {
        self.0.dimensions = dimensions;
        self
    }

    pub fn with_orientation(mut self, orientation: Orientation) -> Self {
        self.0.orientation = orientation;
        self
    }

    pub fn with_center_of_mass(mut self, center_of_mass: Location) -> Self {
        self.0.center_of_mass = center_of_mass;
        self
    }

    pub fn with_velocity(mut self, velocity: VectorF32) -> Self {
        self.0.velocity = velocity;
        self
    }

    pub fn with_aggregate(mut self, aggregate: EntityId) -> Self {
        self.0.aggregates.push(aggregate);
        self
    }

    pub fn with_aggregates(mut self, aggregates: Vec<EntityId>) -> Self {
        self.0.aggregates = aggregates;
        self
    }

    pub fn with_entity(mut self, entity: EntityId) -> Self {
        self.0.entities.push(entity);
        self
    }

    pub fn with_entities(mut self, entities: Vec<EntityId>) -> Self {
        self.0.entities = entities;
        self
    }

    pub fn with_silent_aggregate_system(mut self, silent_aggregate_system: SilentAggregateSystem) -> Self {
        self.0.silent_aggregate_systems.push(silent_aggregate_system);
        self
    }

    pub fn with_silent_aggregate_systems(mut self, silent_aggregate_systems: Vec<SilentAggregateSystem>) -> Self {
        self.0.silent_aggregate_systems = silent_aggregate_systems;
        self
    }

    pub fn with_silent_entity_system(mut self, silent_entity_system: SilentEntitySystem) -> Self {
        self.0.silent_entity_systems.push(silent_entity_system);
        self
    }

    pub fn with_silent_entity_systems(mut self, silent_entity_systems: Vec<SilentEntitySystem>) -> Self {
        self.0.silent_entity_systems = silent_entity_systems;
        self
    }

    pub fn with_variable_datum(mut self, variable_datum: VariableDatum) -> Self {
        self.0.variable_datums.push(variable_datum);
        self
    }

    pub fn with_variable_datums(mut self, variable_datums: Vec<VariableDatum>) -> Self {
        self.0.variable_datums = variable_datums;
        self
    }
}