2024-06-04 23:00:22 +03:00
|
|
|
/**
|
|
|
|
* Module: Schema of Synthesis Operations.
|
|
|
|
*/
|
2025-02-12 21:36:25 +03:00
|
|
|
|
2025-03-12 12:04:50 +03:00
|
|
|
import { type Graph } from '@/models/graph';
|
2024-07-21 15:19:57 +03:00
|
|
|
|
2025-02-21 21:15:05 +03:00
|
|
|
import { type ICstSubstituteInfo, type IOperationDTO, type IOperationSchemaDTO } from '../backend/types';
|
2025-02-18 23:39:11 +03:00
|
|
|
|
2025-03-14 20:44:23 +03:00
|
|
|
/** Represents Operation. */
|
2025-02-18 23:39:11 +03:00
|
|
|
export interface IOperation extends IOperationDTO {
|
2025-04-06 15:49:43 +03:00
|
|
|
x: number;
|
|
|
|
y: number;
|
2025-02-18 23:39:11 +03:00
|
|
|
is_owned: boolean;
|
|
|
|
is_consolidation: boolean; // aka 'diamond synthesis'
|
|
|
|
substitutions: ICstSubstituteInfo[];
|
|
|
|
arguments: number[];
|
|
|
|
}
|
2024-07-21 15:19:57 +03:00
|
|
|
|
2025-03-14 20:44:23 +03:00
|
|
|
/** Represents {@link IOperationSchema} statistics. */
|
2024-07-26 00:34:08 +03:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2025-03-14 20:44:23 +03:00
|
|
|
/** Represents OperationSchema. */
|
2025-02-18 23:39:11 +03:00
|
|
|
export interface IOperationSchema extends IOperationSchemaDTO {
|
2025-04-06 15:49:43 +03:00
|
|
|
operations: IOperation[];
|
2024-06-04 23:00:22 +03:00
|
|
|
|
2024-07-21 15:19:57 +03:00
|
|
|
graph: Graph;
|
2025-02-12 15:13:37 +03:00
|
|
|
schemas: number[];
|
2024-07-26 00:34:08 +03:00
|
|
|
stats: IOperationSchemaStats;
|
2025-02-17 15:12:15 +03:00
|
|
|
operationByID: Map<number, IOperation>;
|
2024-07-21 15:19:57 +03:00
|
|
|
}
|
|
|
|
|
2025-03-14 20:44:23 +03:00
|
|
|
/** Represents substitution error description. */
|
2024-08-26 17:25:07 +03:00
|
|
|
export interface ISubstitutionErrorDescription {
|
|
|
|
errorType: SubstitutionErrorType;
|
|
|
|
params: string[];
|
|
|
|
}
|
|
|
|
|
2025-03-14 20:44:23 +03:00
|
|
|
/** Represents Substitution table error types. */
|
|
|
|
export const SubstitutionErrorType = {
|
|
|
|
invalidIDs: 0,
|
|
|
|
incorrectCst: 1,
|
|
|
|
invalidClasses: 2,
|
|
|
|
invalidBasic: 3,
|
|
|
|
invalidConstant: 4,
|
|
|
|
typificationCycle: 5,
|
|
|
|
baseSubstitutionNotSet: 6,
|
|
|
|
unequalTypification: 7,
|
|
|
|
unequalExpressions: 8,
|
|
|
|
unequalArgsCount: 9,
|
|
|
|
unequalArgs: 10
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type SubstitutionErrorType = (typeof SubstitutionErrorType)[keyof typeof SubstitutionErrorType];
|