diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2016-04-09 14:22:20 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2016-04-09 15:48:01 -0700 |
commit | 3102d8bce3426d9cf41aeaf201c360d342677770 (patch) | |
tree | 38c4f1e8828f9af9c4b77a173bee0d312b321698 /src/com/p4square/grow/model/Chapter.java | |
parent | bbf907e51dfcf157bdee24dead1d531122aa25db (diff) |
Switching from Ivy+Ant to Maven.
Diffstat (limited to 'src/com/p4square/grow/model/Chapter.java')
-rw-r--r-- | src/com/p4square/grow/model/Chapter.java | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/src/com/p4square/grow/model/Chapter.java b/src/com/p4square/grow/model/Chapter.java deleted file mode 100644 index 3a08e4c..0000000 --- a/src/com/p4square/grow/model/Chapter.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2013 Jesse Morgan - */ - -package com.p4square.grow.model; - -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * Chapter is a list of VideoRecords in a Playlist. - * - * @author Jesse Morgan <jesse@jesterpm.net> - */ -public class Chapter implements Cloneable { - private String mName; - private Map<String, VideoRecord> mVideos; - - public Chapter(String name) { - mName = name; - mVideos = new HashMap<String, VideoRecord>(); - } - - /** - * Private constructor for JSON decoding. - */ - private Chapter() { - this(null); - } - - /** - * @return The Chapter name. - */ - public String getName() { - return mName; - } - - /** - * Set the chapter name. - * - * @param name The name of the chapter. - */ - public void setName(final String name) { - mName = name; - } - - /** - * @return The VideoRecord for videoid or null if videoid is not in the chapter. - */ - public VideoRecord getVideoRecord(String videoid) { - return mVideos.get(videoid); - } - - /** - * @return A map of video ids to VideoRecords. - */ - @JsonAnyGetter - public Map<String, VideoRecord> getVideos() { - return mVideos; - } - - /** - * Set the VideoRecord for a video id. - * @param videoId the video id. - * @param video the VideoRecord. - */ - @JsonAnySetter - public void setVideoRecord(String videoId, VideoRecord video) { - mVideos.put(videoId, video); - } - - /** - * Remove the VideoRecord for a video id. - * @param videoId The id to remove. - */ - public void removeVideoRecord(String videoId) { - mVideos.remove(videoId); - } - - /** - * @return true if every required video has been completed. - */ - @JsonIgnore - public boolean isComplete() { - boolean complete = true; - - for (VideoRecord r : mVideos.values()) { - if (r.getRequired() && !r.getComplete()) { - return false; - } - } - - return complete; - } - - /** - * Deeply clone a chapter. - * - * @return a new Chapter object identical but independent of this one. - */ - public Chapter clone() throws CloneNotSupportedException { - Chapter c = new Chapter(mName); - for (Map.Entry<String, VideoRecord> videoEntry : mVideos.entrySet()) { - c.setVideoRecord(videoEntry.getKey(), videoEntry.getValue().clone()); - } - return c; - } -} |