;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [ProductGamesystemEditorComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(ProductGamesystemEditorComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts
new file mode 100644
index 0000000..5648def
--- /dev/null
+++ b/src/app/editor/gamesystem-editor/product-gamesystem-editor/product-gamesystem-editor.component.ts
@@ -0,0 +1,17 @@
+import {Component, Input} from '@angular/core';
+import {ProductGamesystem} from "../../../game-model/gamesystems/ProductGamesystem";
+import {ProductStateEditorComponent} from "../state-editor/product-state-editor/product-state-editor.component";
+
+@Component({
+ selector: 'app-product-gamesystem-editor',
+ standalone: true,
+ imports: [
+ ProductStateEditorComponent
+ ],
+ templateUrl: './product-gamesystem-editor.component.html',
+ styleUrl: './product-gamesystem-editor.component.scss'
+})
+export class ProductGamesystemEditorComponent {
+
+ @Input() gamesystem: ProductGamesystem | undefined
+}
diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html
new file mode 100644
index 0000000..1f4a1d3
--- /dev/null
+++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html
@@ -0,0 +1 @@
+product-state-editor works!
diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.spec.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.spec.ts
new file mode 100644
index 0000000..21f6882
--- /dev/null
+++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ProductStateEditorComponent } from './product-state-editor.component';
+
+describe('ProductStateEditorComponent', () => {
+ let component: ProductStateEditorComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [ProductStateEditorComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(ProductStateEditorComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts
new file mode 100644
index 0000000..608c881
--- /dev/null
+++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts
@@ -0,0 +1,14 @@
+import {Component, Input} from '@angular/core';
+import {ProductGamesystem} from "../../../../game-model/gamesystems/ProductGamesystem";
+
+@Component({
+ selector: 'app-product-state-editor',
+ standalone: true,
+ imports: [],
+ templateUrl: './product-state-editor.component.html',
+ styleUrl: './product-state-editor.component.scss'
+})
+export class ProductStateEditorComponent {
+
+ @Input() gamesystem: ProductGamesystem | undefined
+}
diff --git a/src/app/game-model/gamesystems/Gamesystem.ts b/src/app/game-model/gamesystems/Gamesystem.ts
index 0dea6ba..2625649 100644
--- a/src/app/game-model/gamesystems/Gamesystem.ts
+++ b/src/app/game-model/gamesystems/Gamesystem.ts
@@ -11,8 +11,6 @@ export abstract class Gamesystem extends ModelComponent{
super(gamesystemName, "", ModelComponentType.GAMESYTEM);
}
- abstract createState(label: string, description: string): S|undefined;
-
abstract createTransition(startingState: S, endingState: S): T|undefined;
abstract removeState(state: S): boolean;
diff --git a/src/app/game-model/gamesystems/ProductGamesystem.ts b/src/app/game-model/gamesystems/ProductGamesystem.ts
index 84a135d..46db3d5 100644
--- a/src/app/game-model/gamesystems/ProductGamesystem.ts
+++ b/src/app/game-model/gamesystems/ProductGamesystem.ts
@@ -33,8 +33,14 @@ export class ProductGamesystem extends Gamesystem[]): ProductState | undefined {
+ if(innerStates.length == this.innerGamesystems.length && this.findProductStateByInnerStates(innerStates)== undefined) {
+ const productState = new ProductState(innerStates);
+ this.states.push(productState);
+ return productState;
+ } else {
+ return undefined;
+ }
}
createTransition(startingState: ProductState, endingState: ProductState): ProductTransition | undefined {
@@ -57,4 +63,21 @@ export class ProductGamesystem extends Gamesystem, Transition>) {
this.innerGamesystems = this.innerGamesystems.filter(childSystem => childSystem != gamesystem);
}
+
+ findProductStateByInnerStates(innerStates: State[]) {
+ return this.states.find(productState => productState.equalInnerStates(innerStates));
+ }
+
+ findChildSystemByName(gamesystemName: string) {
+ const gamesystemQueue: Gamesystem, Transition>[] = [];
+ this.innerGamesystems.forEach(gamesystem => gamesystemQueue.push(gamesystem));
+
+ while(gamesystemName.length > 0 ){
+ const currentGamesystem = gamesystemQueue.shift();
+ if(currentGamesystem!.componentName === gamesystemName) {
+ return currentGamesystem;
+ }
+ }
+ return undefined;
+ }
}
diff --git a/src/app/game-model/gamesystems/ProductState.ts b/src/app/game-model/gamesystems/ProductState.ts
index 8a5cbaf..f499f35 100644
--- a/src/app/game-model/gamesystems/ProductState.ts
+++ b/src/app/game-model/gamesystems/ProductState.ts
@@ -1,7 +1,42 @@
import {ProductTransition} from "./ProductTransition";
import {State} from "./State";
import {SimpleState} from "./SimpleState";
+import {Transition} from "./Transition";
export class ProductState extends State {
- innerStates: SimpleState[] = [];
+ innerStates: State[] = [];
+
+ constructor(innerStates: State[]) {
+ super();
+ this.innerStates = innerStates;
+ }
+
+ equalInnerStates(innerStates: State[]) {
+ if(innerStates == undefined || this.innerStates.length != innerStates.length) {
+ return false;
+ }
+
+ for(let i=0; i>): boolean {
+ if(state instanceof SimpleState || this.innerStates.length != (state as ProductState).innerStates.length) {
+ return false;
+ }
+
+ for(let i=0; i {
+ stateLabel: string = "";
+ stateDescription: string = "";
+
+
+ constructor(stateLabel: string, stateDescription: string) {
+ super();
+ this.stateLabel = stateLabel;
+ this.stateDescription = stateDescription;
+ }
+
+ equals(state: State>): boolean {
+ if(!(state instanceof SimpleState)) {
+ return false;
+ }
+ return this.stateLabel === (state as SimpleState).stateLabel;
+ }
+
}
diff --git a/src/app/game-model/gamesystems/State.ts b/src/app/game-model/gamesystems/State.ts
index 5184811..d6b78de 100644
--- a/src/app/game-model/gamesystems/State.ts
+++ b/src/app/game-model/gamesystems/State.ts
@@ -1,19 +1,12 @@
import {Transition} from "./Transition";
export abstract class State> {
- stateLabel: string = "";
- stateDescription: string = "";
+
incomingTransitions: T[] =[];
outgoingTransitions: T[] =[];
initial: boolean = false;
-
- constructor(stateLabel: string, stateDescription: string) {
- this.stateLabel = stateLabel;
- this.stateDescription = stateDescription;
- }
-
addIncomingTransition(transition: T) {
this.incomingTransitions.push(transition);
}
@@ -29,4 +22,6 @@ export abstract class State> {
removeOutgoingTransition(transition: T) {
}
+
+ abstract equals(state: State>): boolean;
}