I made this project for my software design patterns class as an example of the memento pattern.
This project is an application to assist the user in haggling. It helps buyers buy low and sellers sell high. It is useful for yard sales, real estate, insurance, business, and even government. This release is optimized for an insurance claims negotiation.
The use case of memento pattern here is the undo feature in the console based user interface. The application promts the user to chose a role: either buyer or seller. If the user is the seller they must enter a starting price. The user is then prompted to enter the other party's counter offer amount and suggests what the user's optimal next counter amount should be. After each exchange, the user can press "u" to undo and application will undo the last exchange.
My primary design goal was to create a way for a user to perform an undo action. I have achieved that goal through the memento pattern. Another goal is flexibility. Memento pattern also supports that goal as the memento and care taker classes could be used with a GUI or other client code. In this release the client code is the main class which contains the console user interface logic.
We use Apache Maven to compile and run this project.
You need to install Apache Maven (https://maven.apache.org/) on your system.
Type on the command line:
mvn clean compile
mvn clean compile assembly:single
mvn -q clean compile exec:java -Dexec.executable="edu.bu.met.cs665.Main" -Dlog4j.configuration="file:log4j.properties"
We recommand the above command for running the project.
Alternativly, you can run the following command. It will generate a single jar file with all of the dependencies.
mvn clean compile assembly:single
java -Dlog4j.configuration=file:log4j.properties -classpath ./target/JavaProjectTemplate-1.0-SNAPSHOT-jar-with-dependencies.jar edu.bu.met.cs665.Main
mvn clean compile test
To see bug detail using the Findbugs GUI, use the following command "mvn findbugs:gui"
Or you can create a XML report by using
mvn findbugs:gui
or
mvn findbugs:findbugs
For more info about FindBugs see
http:https://findbugs.sourceforge.net/
And about Maven Findbug plugin see https://gleclaire.github.io/findbugs-maven-plugin/index.html
You can install Findbugs Eclipse Plugin
http:https://findbugs.sourceforge.net/manual/eclipse.html
SpotBugs https://spotbugs.github.io/ is the spiritual successor of FindBugs.
CheckStyle code styling configuration files are in config/ directory. Maven checkstyle plugin is set to use google code style. You can change it to other styles like sun checkstyle.
To analyze this example using CheckStyle run
mvn checkstyle:check
This will generate a report in XML format
target/checkstyle-checker.xml
target/checkstyle-result.xml
and the following command will generate a report in HTML format that you can open it using a Web browser.
mvn checkstyle:checkstyle
target/site/checkstyle.html
mvn -DrepoToken=YOUR-REPO-TOCKEN-ON-COVERALLS cobertura:cobertura coveralls:report