Refactor Generation from Childsystems to allow seperation between product and producttemplate
All checks were successful
E2E Testing / test (push) Successful in 1m31s

This commit is contained in:
Sebastian Böckelmann 2024-04-12 18:54:02 +02:00
parent b4abd43bc0
commit 9d565aad35
3 changed files with 30 additions and 7 deletions

View File

@ -24,25 +24,22 @@ export abstract class AbstractProductGamesystemGenerator {
const rightInitialData = this.prepareChildsystemForGeneration(this.productGamesystem.innerGamesystems[1]) const rightInitialData = this.prepareChildsystemForGeneration(this.productGamesystem.innerGamesystems[1])
const initialGenerationResult = this.generateFromBinaryChildsystems(leftInitialData, rightInitialData); const initialGenerationResult = this.generateFromBinaryChildsystems(leftInitialData, rightInitialData);
console.log("Debug msg2")
if(this.productGamesystem.innerGamesystems.length > 2) { if(this.productGamesystem.innerGamesystems.length > 2) {
console.log("Deeper construction")
for(let i=2; i<this.productGamesystem.innerGamesystems.length; i++) { for(let i=2; i<this.productGamesystem.innerGamesystems.length; i++) {
const leftData = initialGenerationResult.productGenerationData; const leftData = initialGenerationResult.productGenerationData;
const rightData = this.prepareChildsystemForGeneration(this.productGamesystem.innerGamesystems[i]); const rightData = this.prepareChildsystemForGeneration(this.productGamesystem.innerGamesystems[i]);
const generationResult = this.generateFromBinaryChildsystems(leftData, rightData); const generationResult = this.generateFromBinaryChildsystems(leftData, rightData);
this.productGamesystem.states = generationResult.states; this.assignGeneratedStatesAndTransitions(generationResult)
this.productGamesystem.transitions = generationResult.transitions;
} }
} else { } else {
console.log("Simple construction ", initialGenerationResult.states) this.assignGeneratedStatesAndTransitions(initialGenerationResult)
this.productGamesystem.states = initialGenerationResult.states;
this.productGamesystem.transitions = initialGenerationResult.transitions
} }
} }
protected abstract assignGeneratedStatesAndTransitions(generationResult: ProductGeneratorResult): void;
protected prepareChildsystemForGeneration(childsystem: Gamesystem<any, any>) { protected prepareChildsystemForGeneration(childsystem: Gamesystem<any, any>) {
if(childsystem instanceof ProductGamesystem) { if(childsystem instanceof ProductGamesystem) {
childsystem.productGamesystemGenerator.generateFromChildsystems(); childsystem.productGamesystemGenerator.generateFromChildsystems();

View File

@ -9,9 +9,15 @@ import {ProductTransition} from "../transitions/ProductTransition";
import {Transition} from "../transitions/Transition"; import {Transition} from "../transitions/Transition";
import {ScriptAccountAction} from "../actions/ScriptAccountAction"; import {ScriptAccountAction} from "../actions/ScriptAccountAction";
import {AbstractProductGamesystemGenerator} from "./AbstractProductGamesystemGenerator"; import {AbstractProductGamesystemGenerator} from "./AbstractProductGamesystemGenerator";
import {transition} from "@angular/animations";
import * as console from "node:console";
export class ProductGamesystemGenerator extends AbstractProductGamesystemGenerator { export class ProductGamesystemGenerator extends AbstractProductGamesystemGenerator {
protected assignGeneratedStatesAndTransitions(generationResult: ProductGeneratorResult): void {
this.productGamesystem.states = generationResult.states;
this.productGamesystem.transitions = generationResult.transitions;
}
protected generateBinaryProductTransition(startingState: ProductState, endingState: ProductState, usedTransition: Transition<any>, generatedTransitions: ProductTransition[]) { protected generateBinaryProductTransition(startingState: ProductState, endingState: ProductState, usedTransition: Transition<any>, generatedTransitions: ProductTransition[]) {
const transition = new ProductTransition(startingState, endingState); const transition = new ProductTransition(startingState, endingState);

View File

@ -1,5 +1,25 @@
import {AbstractProductGamesystemGenerator} from "./AbstractProductGamesystemGenerator"; import {AbstractProductGamesystemGenerator} from "./AbstractProductGamesystemGenerator";
import {State} from "../states/State";
import {ProductState} from "../states/ProductState";
import {Transition} from "../transitions/Transition";
import {ProductTransition} from "../transitions/ProductTransition";
import {ProductGeneratorResult} from "./ProductGeneratorResult";
export class ProductTemplateGamesystemGenerator extends AbstractProductGamesystemGenerator{ export class ProductTemplateGamesystemGenerator extends AbstractProductGamesystemGenerator{
protected assignGeneratedStatesAndTransitions(generationResult: ProductGeneratorResult): void {
}
protected generateBinaryProductState(leftState: State<any>, rightState: State<any>, generadedStates: ProductState[]): ProductState | undefined {
return undefined;
}
protected generateBinaryProductTransition(leftState: State<any>, rightState: State<any>, usedTransition: Transition<any>, generatedTransitions: ProductTransition[]): void {
}
protected generateBinaryProductTransitionMulti(leftState: State<any>, rightState: State<any>, leftTransition: Transition<any>, rightTransition: Transition<any>, generatedTransitions: ProductTransition[]): void {
}
} }