template-systems #41

Merged
sebastian merged 30 commits from template-systems into main 2024-04-19 21:10:01 +02:00
2 changed files with 35 additions and 0 deletions
Showing only changes of commit 7cb02030d9 - Show all commits

View File

@ -0,0 +1,27 @@
import {IsolatedTemplateStateGenerator} from "./IsolatedTemplateStateGenerator";
import {ProductGenerationData} from "./ProductGenerationData";
import {ProductGeneratorResult} from "./ProductGeneratorResult";
import {ProductState} from "../states/ProductState";
export class IsolatedSymmetricTemplateStateGenerator extends IsolatedTemplateStateGenerator{
protected generateBinaryIsolatedProductStates(leftSystemData: ProductGenerationData, rightSystemData: ProductGenerationData): ProductGeneratorResult {
const generatedProductStates: ProductState[] = []
leftSystemData.states.forEach(leftState => {
if(leftState.outgoingTransitions.length == 0 && leftState.incomingTransitions.length == 0) {
rightSystemData.states.forEach(rightState => {
if(leftState.equals(rightState) && rightState.outgoingTransitions.length == 0 && rightState.incomingTransitions.length == 0) {
const leftConditions = this.getStateConditions(leftState, true);
const rightConditions = this.getStateConditions(rightState, true);
if(!this.contradictCombinedConditions(leftConditions, rightConditions)) {
this.generateBinaryProductState(leftState, rightState, generatedProductStates);
}
}
})
}
})
return new ProductGeneratorResult(generatedProductStates, []);
}
}

View File

@ -11,6 +11,9 @@ import {
SymmetricProductTemplateGenerator SymmetricProductTemplateGenerator
} from "../../gamesystems/productSystemGenerator/SymmetricProductTemplateGenerator"; } from "../../gamesystems/productSystemGenerator/SymmetricProductTemplateGenerator";
import {IsolatedTemplateStateGenerator} from "../../gamesystems/productSystemGenerator/IsolatedTemplateStateGenerator"; import {IsolatedTemplateStateGenerator} from "../../gamesystems/productSystemGenerator/IsolatedTemplateStateGenerator";
import {
IsolatedSymmetricTemplateStateGenerator
} from "../../gamesystems/productSystemGenerator/IsolatedSymmetricTemplateStateGenerator";
export class ProductTemplateSystem extends ProductGamesystem implements TemplateGamesystem{ export class ProductTemplateSystem extends ProductGamesystem implements TemplateGamesystem{
@ -29,6 +32,11 @@ export class ProductTemplateSystem extends ProductGamesystem implements Template
if(this.symmetric) { if(this.symmetric) {
const symmetricGenerator = new SymmetricProductTemplateGenerator(this, templateElement); const symmetricGenerator = new SymmetricProductTemplateGenerator(this, templateElement);
symmetricGenerator.generateFromChildsystems() symmetricGenerator.generateFromChildsystems()
if(this.generateIsolatedStates) {
const isolatedTemplateStateGenerator = new IsolatedSymmetricTemplateStateGenerator(this, templateElement);
isolatedTemplateStateGenerator.generateFromChildsystems();
}
} else { } else {
const productTemplateGenerator = new TemplateProductSystemGenerator(this, templateElement); const productTemplateGenerator = new TemplateProductSystemGenerator(this, templateElement);
productTemplateGenerator.generateFromChildsystems() productTemplateGenerator.generateFromChildsystems()