Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 2.21 KB

File metadata and controls

45 lines (30 loc) · 2.21 KB

JAVA-DesginPatterns-DynamicProxy-Reflection-Strategy

JAVA project to design a Generic Library for Serializing and De-serializing Objects (Check-pointing Objects) using Dynamic Proxy, Java Reflection, and Strategy Pattern

Assuming you are in the directory containing this README:

To clean:

ant -buildfile src/build.xml clean


To compile:

ant -buildfile src/build.xml all


To run by specifying arguments from command line

We will use this to run your code

ant -buildfile src/build.xml run -Darg0=FIRST -Darg1=SECOND -Darg2=THIRD

FIRST:mode SECOND:number_of_objects THIRD:filepath


To create tarball for submission

ant -buildfile src/build.xml tarzip or tar -zcvf vidhi_kamdar_assign6.tar.gz vidhi_kamdar_assign6


Brief on implementation of State Pattern: ->Driver class initializes instance of Context class. For every line of the input file, the context class will call tightenOrLoosenSecurity method on the current state depending on the average traffic and average prohibited items. This calculation is carried out by CalculateAverage class. Depending on the current state, the operation ids are selected and added to the results arraylist.

Provide justification for Data Structures used in this assignment in terms of Big O complexity (time and/or space)

ArrayList<String[]> for storing each line while serializing into xml: The number of lines of file may keep changing(ArrayList is suitable) but the fields may be fixed(String[] is suitable). getElement:O(1); Search:O(n) under normal circumstances

Vector for storing serializable and deserializable objects since it is synchronized ArrayList is not fixed size, hence we can modify it more frequently when needed.Storing results needs constant change in size of the list according to the test cases.Even if we set an initial size, we can still modify the size

Big O Time complexity:O(n) under normal circumstances