Skip to content

Instantly share code, notes, and snippets.

@mgp
Created March 5, 2015 22:04
Show Gist options
  • Save mgp/f97732cc34224d76306e to your computer and use it in GitHub Desktop.
Save mgp/f97732cc34224d76306e to your computer and use it in GitHub Desktop.
package org.khanacademy.core.topictree.models;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import org.khanacademy.core.topictree.identifiers.ContentItemIdentifiable;
import org.khanacademy.core.topictree.identifiers.ContentItemIdentifier;
import org.khanacademy.core.topictree.identifiers.ContentItemKind;
/**
* An exercise, which is a content item.
*/
public final class Exercise implements ContentItemIdentifiable {
public final String contentId;
public final ExerciseDescriptor descriptor;
// TODO(mgp): Merge this into descriptor?
public final String khanExercisesFilename;
public final String progressKey;
public Exercise(String contentId,
ExerciseDescriptor descriptor,
String khanExercisesFilename,
String progressKey) {
this.contentId = Preconditions.checkNotNull(contentId);
this.descriptor = Preconditions.checkNotNull(descriptor);
this.khanExercisesFilename = Preconditions.checkNotNull(khanExercisesFilename);
this.progressKey = Preconditions.checkNotNull(progressKey);
}
@Override
public ContentItemIdentifier getIdentifier() {
return new ContentItemIdentifier(ContentItemKind.EXERCISE, contentId);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("contentId", contentId)
.add("descriptor", descriptor)
.add("khanExercisesFilename", khanExercisesFilename)
.add("progressKey", progressKey)
.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment