All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.app.core.model.scenario.scenario-component.model.ts Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
import { areEquals, Equals } from '@shared/equals';
import { Clonable, cloneAsPossible } from '@shared/clonable';
import { ComponentTask, KeyValue } from '../component-task.model';

export class ScenarioComponent implements Equals, Clonable {

    constructor(
        public id?: string,
        public title: string = 'Title',
        public description: string = 'Description',
        public creationDate?: Date,
        public updateDate?: Date,
        public version?: number,
        public author?: string,
        public componentSteps: Array = [],
        public parameters: Array = [],
        public computedParameters: Array = [],
        public tags: Array = [],
        public datasetId: string = null
    ) {
    }

    public equals(obj: ScenarioComponent): boolean {
        return obj
            && areEquals(this.title, obj.title)
            && areEquals(this.description, obj.description)
            && areEquals(this.componentSteps, obj.componentSteps)
            && areEquals(this.parameters, obj.parameters)
            && areEquals(this.tags, obj.tags)
            && areEquals(this.computedParameters, obj.computedParameters)
            && areEquals(this.datasetId, obj.datasetId);
    }

    public clone(): ScenarioComponent {
        return new ScenarioComponent(
            cloneAsPossible(this.id), // TODO - Is cloning id is a good idea ?
            cloneAsPossible(this.title),
            cloneAsPossible(this.description),
            cloneAsPossible(this.creationDate),
            cloneAsPossible(this.updateDate),
            cloneAsPossible(this.version),
            cloneAsPossible(this.author),
            cloneAsPossible(this.componentSteps),
            cloneAsPossible(this.parameters),
            cloneAsPossible(this.computedParameters),
            cloneAsPossible(this.tags),
            cloneAsPossible(this.datasetId)
        );
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy