Tuesday, July 19, 2016

Week 13

Still Work in Progress....


Last week a compilable class goal was achieved.So this week was about setting up tests.
Since deviser generates and select random UUID and prime number, the two methods were adapted for running tests. In the case of prime number, random.seed was set to 0 as for the UUID to a fixed number,as random seed would not affect it.
The foundation of java tests served test_cpp_code files, which were adapted for the java files generation. The path separator was changed to os.sep, so it uses OS specific separator.

javap parser 

jsbml jar was put inside deviser package and javap works under Windows as well.

List of modifications

  1. added lo_element writer
  2. fixed problem with brackets for equals and copy constructor.

Tuesday, July 12, 2016

Week 12

Hello all,

Here's the summary:

Compilable Class

Deviser generates a compilable QualitativeSpecie.java(Fig.1). The class also worked as a replacement in the official jsbml code, but since deviser does not generate not generate   QualitativeSpecies(species) constructor, that part of the code had to be commented in the official jsbml code, after that the compilation was successful(https://gist.github.com/hovo1990/c3ce45eb0d61cefe5c2440d65a45d5be).

Fig.1 Compilable QualitativeSpecies.java

UUID generator

Dr. Bergmann gave valuable help and recommendation for the generation of UUIDs.
Python includes uuid module, that can be used for the generation of uuids, but since Java uses long 64 bit, while python generates 128 bit, the generated uuid had to be masked.
After changing to 56 bit, java compiler would not give more errors for being too long.

hashCode method changes

Generated prime numbers were changed to a global variable, so that the numbers are only generated once.

Implemented Methods

Here's the list of the methods, that were implemented during this week:
  1. prototype writeXMLAttributes
  2. fixed functions with same name generator
  3. prototype toString
  4. prototype readAttribute

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.