Introduce Symetric and Asymetric Template Relation Systems #40

Merged
sebastian merged 23 commits from assymetric-template-relation-systems into template-systems 2024-04-19 20:04:54 +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
} from "../../gamesystems/productSystemGenerator/SymmetricProductTemplateGenerator";
import {IsolatedTemplateStateGenerator} from "../../gamesystems/productSystemGenerator/IsolatedTemplateStateGenerator";
import {
IsolatedSymmetricTemplateStateGenerator
} from "../../gamesystems/productSystemGenerator/IsolatedSymmetricTemplateStateGenerator";
export class ProductTemplateSystem extends ProductGamesystem implements TemplateGamesystem{
@ -29,6 +32,11 @@ export class ProductTemplateSystem extends ProductGamesystem implements Template
if(this.symmetric) {
const symmetricGenerator = new SymmetricProductTemplateGenerator(this, templateElement);
symmetricGenerator.generateFromChildsystems()
if(this.generateIsolatedStates) {
const isolatedTemplateStateGenerator = new IsolatedSymmetricTemplateStateGenerator(this, templateElement);
isolatedTemplateStateGenerator.generateFromChildsystems();
}
} else {
const productTemplateGenerator = new TemplateProductSystemGenerator(this, templateElement);
productTemplateGenerator.generateFromChildsystems()