Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
This fact is only used for preserving the original appearance of the source code after transformations. It declares that an array initialization (represented by a newarrayt fact) omits the explicit array instantiation in the orginal source code, being written as
int[] a = {1,2,3};
instead of
int[] a = new int[] {1,2,3}
#id: newArrayT
ID of the newArrayT element.
The source code
int[] a = {1,2,3};
is represented in JTransformer as
localT(#ID, #ParentID, _, type(basic, int, 1), 'a', #newArrayT). newArrayT(#newArrayT, #ID, _, [], [IDa0, IDa1, IDa2], type(basic, int, 1)). omitArrayDeclarationT(#newArrayT). **<----** literalT(IDa0, #newArrayT, _, type(basic, int, 0), '1'). literalT(IDa1, #newArrayT, _, type(basic, int, 0), '2'). literalT(IDa2, #newArrayT, _, type(basic, int, 0), '3').
Note that the use of the omitArrayDeclarationT(V3). fact is the only difference to the case when an explicit array initialisation is used in the source code (see below).
The source code
int[] a = new int[] {1,2,3}
is represented in JTransformer as
localT(#ID, #ParentID, _, type(basic, int, 1), 'a', #newArrayT). newArrayT(#newArrayT, #ID, _, [], [IDa0, IDa1, IDa2], type(basic, int, 1)). literalT(IDa0, #newArrayT, _, type(basic, int, 0), '1'). literalT(IDa1, #newArrayT, _, type(basic, int, 0), '2'). literalT(IDa2, #newArrayT, _, type(basic, int, 0), '3').
ast_relation('Java',omitArrayDeclarationT,[ ast_arg(id, mult(1,1,no ), id, [newArrayT]) ]).