Tuesday, July 5, 2016

Week 11

Organize helper functions

Removed duplicate codes and  placed frequent helper functions inside a new module: jsbmlHelperFunctions.py, which includes functions for determining whether a method has to be overriden, javap argument parser, get javadoc comments, finding methods with same name that take different argument and prime number generator.

Constructor generator

Deviser now generates copy constructors.

Method generators

Deviser can generate get_instance, is_set_instance, equals and hashCode methods.

hashCode method

The generator uses algorithm found from stackoverflow.  Right now generates  up to 10 to the 6th power(has to be changed) and than uses pythons random.choice  method for selecting a prime number, but this part needs to be discussed with the mentors. 

Things to do

With the generation of the new methods, previous errors during compilation would vanish, but new ones appeared.Only 3 methods are left to be implemented: readAttribute, writeAttributes and toString.
Finish readAttribute method, which turned out to be a little problematic, write writeAttributes and create the last method generator,which is for toString method.
As for fixing the order of the functions, the idea is to create a dictionary with the function name as key,sort keys and write methods, but that approach would consume more memory, I think it'll be nice to discuss it during TC.

No comments:

Post a Comment