java2ib
Version:
TypeScript library that converts Java code into IB Computer Science pseudocode format
94 lines • 3.48 kB
TypeScript
/**
* IB Rules Engine for converting Java constructs to IB pseudocode format
*/
export interface VariableInfo {
originalName: string;
pseudocodeName: string;
type: string;
scope: string;
}
export interface MethodInfo {
originalName: string;
pseudocodeName: string;
returnType: string;
parameters: ParameterInfo[];
isVoid: boolean;
isStatic: boolean;
}
export interface ParameterInfo {
originalName: string;
pseudocodeName: string;
type: string;
}
/**
* Engine that encapsulates IB-specific conversion rules
*/
export declare class IBRulesEngine {
/**
* Convert Java camelCase variable names to UPPERCASE format
* @param javaName - The Java variable name in camelCase
* @returns The converted UPPERCASE variable name
*/
convertVariableName(javaName: string): string;
/**
* Convert Java operators to IB pseudocode operators
* @param javaOperator - The Java operator
* @returns The equivalent IB pseudocode operator
*/
convertOperator(javaOperator: string): string;
/**
* Convert Java control structure to IB pseudocode format
* @param type - The type of control structure (if, while, for)
* @param condition - Optional condition for the control structure
* @returns The IB pseudocode control structure format
*/
convertControlStructure(type: string, condition?: string): string;
/**
* Convert Java method declaration to IB function/procedure format
* @param method - Method information
* @returns The IB pseudocode method declaration
*/
convertMethodDeclaration(method: MethodInfo): string;
/**
* Convert Java data type to IB pseudocode format (or null if type should be omitted)
* @param javaType - The Java data type
* @returns The IB pseudocode type or null if type should be omitted
*/
convertDataType(javaType: string): string | null;
/**
* Convert Java for loop to IB pseudocode loop format
* @param variable - Loop variable name
* @param start - Start value
* @param end - End value
* @param step - Step value (optional, defaults to 1)
* @returns The IB pseudocode for loop format
*/
convertForLoop(variable: string, start: string, end: string, step?: string): string;
/**
* Convert Java array length access to IB pseudocode format
* @param arrayName - The array variable name
* @returns The IB pseudocode array size format
*/
convertArrayLength(arrayName: string): string;
/**
* Convert Java I/O statements to IB pseudocode format
* @param type - The type of I/O operation (output, input)
* @param content - The content to output or variable to input
* @returns The IB pseudocode I/O statement
*/
convertIOStatement(type: 'output' | 'input', content: string): string;
/**
* Convert Java string length access to IB pseudocode format
* @param stringName - The string variable name
* @returns The IB pseudocode string length format
*/
convertStringLength(stringName: string): string;
/**
* Convert Java string operations to IB pseudocode format
* @param operation - The string operation type
* @param operands - The operands for the operation
* @returns The IB pseudocode string operation
*/
convertStringOperation(operation: string, ...operands: string[]): string;
}
//# sourceMappingURL=ib-rules-engine.d.ts.map