2024-06-04 23:00:22 +03:00
|
|
|
/**
|
|
|
|
* Module: Schema of Synthesis Operations.
|
|
|
|
*/
|
|
|
|
|
2025-02-10 01:32:55 +03:00
|
|
|
import { ILibraryItem, ILibraryItemData, LibraryItemID } from '@/features/library/models/library';
|
|
|
|
import { ConstituentaID, IConstituenta } from '@/features/rsform/models/rsform';
|
|
|
|
|
|
|
|
import { Graph } from '../../../models/Graph';
|
2024-06-04 23:00:22 +03:00
|
|
|
|
|
|
|
/**
|
2024-07-21 15:19:57 +03:00
|
|
|
* Represents {@link IOperation} identifier type.
|
|
|
|
*/
|
|
|
|
export type OperationID = number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} type.
|
|
|
|
*/
|
|
|
|
export enum OperationType {
|
|
|
|
INPUT = 'input',
|
|
|
|
SYNTHESIS = 'synthesis'
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents Operation.
|
|
|
|
*/
|
|
|
|
export interface IOperation {
|
|
|
|
id: OperationID;
|
|
|
|
operation_type: OperationType;
|
|
|
|
oss: LibraryItemID;
|
|
|
|
|
|
|
|
alias: string;
|
|
|
|
title: string;
|
|
|
|
comment: string;
|
2024-07-24 22:23:35 +03:00
|
|
|
|
2024-07-21 15:19:57 +03:00
|
|
|
position_x: number;
|
|
|
|
position_y: number;
|
|
|
|
|
|
|
|
result: LibraryItemID | null;
|
2024-08-01 20:11:32 +03:00
|
|
|
|
2024-08-15 23:23:45 +03:00
|
|
|
is_owned: boolean;
|
2024-08-17 12:17:13 +03:00
|
|
|
is_consolidation: boolean; // aka 'diamond synthesis'
|
2024-08-01 20:11:32 +03:00
|
|
|
substitutions: ICstSubstituteEx[];
|
|
|
|
arguments: OperationID[];
|
2024-07-21 15:19:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents {@link IOperation} Argument.
|
|
|
|
*/
|
|
|
|
export interface IArgument {
|
|
|
|
operation: OperationID;
|
|
|
|
argument: OperationID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data, used in merging single {@link IConstituenta}.
|
|
|
|
*/
|
|
|
|
export interface ICstSubstitute {
|
|
|
|
original: ConstituentaID;
|
|
|
|
substitution: ConstituentaID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents data, used in merging multiple {@link IConstituenta}.
|
|
|
|
*/
|
2025-01-27 15:03:48 +03:00
|
|
|
export interface ICstSubstitutions {
|
2024-07-21 15:19:57 +03:00
|
|
|
substitutions: ICstSubstitute[];
|
|
|
|
}
|
|
|
|
|
2024-07-29 16:56:24 +03:00
|
|
|
/**
|
|
|
|
* Represents substitution for multi synthesis table.
|
|
|
|
*/
|
|
|
|
export interface IMultiSubstitution {
|
2024-08-14 21:50:28 +03:00
|
|
|
original_source: ILibraryItem;
|
|
|
|
original: IConstituenta;
|
|
|
|
substitution: IConstituenta;
|
|
|
|
substitution_source: ILibraryItem;
|
2024-08-28 15:43:28 +03:00
|
|
|
is_suggestion: boolean;
|
2024-07-29 16:56:24 +03:00
|
|
|
}
|
|
|
|
|
2024-07-21 15:19:57 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link ICstSubstitute} extended data.
|
|
|
|
*/
|
|
|
|
export interface ICstSubstituteEx extends ICstSubstitute {
|
2024-08-01 20:11:32 +03:00
|
|
|
operation: OperationID;
|
2024-07-21 15:19:57 +03:00
|
|
|
original_alias: string;
|
|
|
|
original_term: string;
|
|
|
|
substitution_alias: string;
|
|
|
|
substitution_term: string;
|
|
|
|
}
|
|
|
|
|
2024-07-26 00:34:08 +03:00
|
|
|
/**
|
|
|
|
* Represents {@link IOperationSchema} statistics.
|
|
|
|
*/
|
|
|
|
export interface IOperationSchemaStats {
|
|
|
|
count_operations: number;
|
|
|
|
count_inputs: number;
|
|
|
|
count_synthesis: number;
|
|
|
|
count_schemas: number;
|
2024-08-23 21:29:07 +03:00
|
|
|
count_owned: number;
|
2024-07-26 00:34:08 +03:00
|
|
|
}
|
|
|
|
|
2024-07-21 15:19:57 +03:00
|
|
|
/**
|
2025-01-30 19:55:38 +03:00
|
|
|
* Represents OperationSchema.
|
2024-06-04 23:00:22 +03:00
|
|
|
*/
|
2025-01-30 19:55:38 +03:00
|
|
|
export interface IOperationSchema extends ILibraryItemData {
|
|
|
|
items: IOperation[];
|
2024-07-21 15:19:57 +03:00
|
|
|
arguments: IArgument[];
|
|
|
|
substitutions: ICstSubstituteEx[];
|
2024-06-04 23:00:22 +03:00
|
|
|
|
2024-07-21 15:19:57 +03:00
|
|
|
graph: Graph;
|
2024-07-26 00:34:08 +03:00
|
|
|
schemas: LibraryItemID[];
|
|
|
|
stats: IOperationSchemaStats;
|
2024-07-21 15:19:57 +03:00
|
|
|
operationByID: Map<OperationID, IOperation>;
|
|
|
|
}
|
|
|
|
|
2024-08-26 17:25:07 +03:00
|
|
|
/**
|
|
|
|
* Represents substitution error description.
|
|
|
|
*/
|
|
|
|
export interface ISubstitutionErrorDescription {
|
|
|
|
errorType: SubstitutionErrorType;
|
|
|
|
params: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents Substitution table error types.
|
|
|
|
*/
|
|
|
|
export enum SubstitutionErrorType {
|
|
|
|
invalidIDs,
|
2024-08-26 22:53:27 +03:00
|
|
|
incorrectCst,
|
2024-08-26 17:25:07 +03:00
|
|
|
invalidClasses,
|
|
|
|
invalidBasic,
|
|
|
|
invalidConstant,
|
2024-08-26 22:53:27 +03:00
|
|
|
typificationCycle,
|
|
|
|
baseSubstitutionNotSet,
|
|
|
|
unequalTypification,
|
2024-08-28 12:34:29 +03:00
|
|
|
unequalExpressions,
|
2024-08-26 22:53:27 +03:00
|
|
|
unequalArgsCount,
|
|
|
|
unequalArgs
|
2024-08-26 17:25:07 +03:00
|
|
|
}
|