pub trait MutationLogic<N, E, S, R>: Send + Sync{
// Required methods
fn interpret(
&self,
input: &dyn MutationInput,
map: &GraphMap<N, E, S>,
actions: &ActionsConfig,
rules: &R,
stats: &SwarmStats,
) -> Vec<MapUpdate<N, E, S>>;
fn initialize(
&self,
root_id: MapNodeId,
initial_contexts: &[&str],
rules: &R,
) -> Vec<MapUpdate<N, E, S>>;
fn create_node_data(&self, input: &dyn MutationInput) -> N;
fn create_edge_data(&self, input: &dyn MutationInput) -> E;
fn initial_state(&self) -> S;
fn name(&self) -> &str;
}Expand description
Map 展開ロジック
入力を MapUpdate に変換する責務のみを持つ。 Selection とは分離されている。
Required Methods§
Sourcefn interpret(
&self,
input: &dyn MutationInput,
map: &GraphMap<N, E, S>,
actions: &ActionsConfig,
rules: &R,
stats: &SwarmStats,
) -> Vec<MapUpdate<N, E, S>>
fn interpret( &self, input: &dyn MutationInput, map: &GraphMap<N, E, S>, actions: &ActionsConfig, rules: &R, stats: &SwarmStats, ) -> Vec<MapUpdate<N, E, S>>
入力を MapUpdate に変換
stats を参照して展開ロジックを調整できる(Optional)。
Sourcefn initialize(
&self,
root_id: MapNodeId,
initial_contexts: &[&str],
rules: &R,
) -> Vec<MapUpdate<N, E, S>>
fn initialize( &self, root_id: MapNodeId, initial_contexts: &[&str], rules: &R, ) -> Vec<MapUpdate<N, E, S>>
初期ノードを展開
Sourcefn create_node_data(&self, input: &dyn MutationInput) -> N
fn create_node_data(&self, input: &dyn MutationInput) -> N
ノードデータを生成
Sourcefn create_edge_data(&self, input: &dyn MutationInput) -> E
fn create_edge_data(&self, input: &dyn MutationInput) -> E
エッジデータを生成
Sourcefn initial_state(&self) -> S
fn initial_state(&self) -> S
初期状態を生成