Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgressTracker (quick implementation) #1

Open
dsabsay opened this issue Oct 11, 2016 · 0 comments
Open

ProgressTracker (quick implementation) #1

dsabsay opened this issue Oct 11, 2016 · 0 comments

Comments

@dsabsay
Copy link
Collaborator

dsabsay commented Oct 11, 2016

Information on each performance needs to be logged, in order to display progress information to the user, among other things.

For each performance log:

  • ID for which melody/rhythm
  • Type of melody/rhythm (these are broad categories that group multiple different melodies/rhythms together)
  • What type of performance (i.e. sight singing, or rhythm)
  • Total score
  • Pitch score (not for rhythms)
  • Rhythm score
  • Date when the performance was done
  • Total time spent (in seconds) on the exercise (total elapsed time from when the user was prompted with with a melody/rhythm to when they moved on to the next exercise, or stopped practicing)

After each performance, a record will be stored for that performance. As such, I need a way to write a single new record to the disk without reading in the entire set of stored records. I believe there is a way to do this using ObjectOutuputStreams. The records will be serialized and written to a file. Then later, when they need to be read, they can be deserialized and turned into Java objects again.

Reading and writing Serializable objects:
http://www.javapractices.com/topic/TopicAction.do?Id=57

Way to append object to serialized file:
http://stackoverflow.com/questions/15607969/appending-objects-to-a-serialization-file
http://stackoverflow.com/questions/2094637/how-can-i-append-to-an-existing-java-io-objectstream

For now the records can be stored as a flat list. There should be one file on the disk that stores all records for sight singing, and another file to store all records for rhythms.

A record will be stored for each performance when savePerformanceRecord() is called.

Some Implementation Details

Ideally, savePerformanceRecord() could be called with any type of PerformanceRecord and it would determine the right place to write it to (and also make sure all the specific fields for that type of PerformanceRecord are written).

In order to test, you'll have to make a UserConfiguration object and specify paths that the records will be written to.

There are additional comments in the code.

The methods to implement are:
public void savePerformanceRecord(PerformanceRecord record);
public List<SightSingingRecord> getSightSingingRecords();
public List<RhythmRecord> getRhythmRecords();
public HashMap<String, List<SightSingingRecord>> readSightSingingRecords();
public HashMap<String, List<RhythmRecord>> readRhythmRecords();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant