samedi 5 novembre 2016

What is the name of the pattern that these four Android classes comprise?

There's a bit too much code to post here so, I'll post the github links:

PhotoManager.java

PhotoTask.Java

PhotoDecodeRunnable.java

PhotoDownloadRunnable.java

From the comments in the PhotoTask class:

This class manages PhotoDecodeRunnable and PhotoDownloadRunnable objects. It doesn't perform the download or decode; instead, it manages persistent storage for the tasks that do the work. It does this by implementing the interfaces that the download and decode classes define, and then passing itself as an argument to the constructor of a download or decode object. In effect, this allows PhotoTask to start on a Thread, run a download in a delegate object, then run a decode, and then start over again. This class can be pooled and reused as necessary.

The comment regards PhotoTask as "manages persistent storage for the tasks". Is this the delegate pattern? I'd be appreciative of any knowledge that you have regarding these classes and, the pattern.

Aucun commentaire:

Enregistrer un commentaire