X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkiss%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2FProgram.java;h=12f51db9e8b657689a2e08105cd3d5df62c0cfd6;hb=9d2a49c65872cd9330670a3cace19faf493df04d;hp=2308fa982296ea76368d782043c2425d11af0486;hpb=76827fb7e4bf7e1ecc0b2ef01a75c5751a915964;p=utils diff --git a/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java b/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java index 2308fa98..12f51db9 100644 --- a/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java +++ b/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ package org.wamblee.crawler.kiss; @@ -20,68 +20,141 @@ import org.wamblee.crawler.Action; import org.wamblee.crawler.PageException; /** - * + * Represents a television program. */ public class Program { - + + /** + * Name of the record action on the program details page. + */ private static final String RECORD_ACTION = "record"; + + /** + * Indent string to use for pretty printing. + */ private static final String INDENT = " "; - - private String _channel; + + /** + * Channel the program is on. + */ + private String _channel; + + /** + * Program name. + */ private String _name; - private String _description; + + /** + * Program description. + */ + private String _description; + + /** + * Keywords or classification of the program. + */ private String _keywords; + + /** + * Time interval for the program (from/to). + */ private TimeInterval _interval; - private Action _programInfo; - - public Program(String aChannel, String aName, String aDescription, String aKeywords, TimeInterval aInterval, Action aProgramInfo) { - _channel = aChannel; - _name = aName; + + /** + * Action to execute to obtain program information and/or record the program. + */ + private Action _programInfo; + + /** + * Constructs the program. + * @param aChannel Channel name. + * @param aName Program name. + * @param aDescription Description. + * @param aKeywords Keywords/classification. + * @param aInterval Time interval. + * @param aProgramInfo Action to execute for detailed program information or + * for recording the page. + */ + public Program(String aChannel, String aName, String aDescription, + String aKeywords, TimeInterval aInterval, Action aProgramInfo) { + _channel = aChannel; + _name = aName; _description = aDescription; - _keywords = aKeywords; + _keywords = aKeywords; _interval = aInterval; - _programInfo = aProgramInfo; + _programInfo = aProgramInfo; } - - public String getChannel() { - return _channel; + + /** + * Gets the channel. + * @return Channel. + */ + public String getChannel() { + return _channel; } - - public String getName() { - return _name; + + /** + * Gets the program name. + * @return Name. + */ + public String getName() { + return _name; } - - public String getDescription() { + + /** + * Gets the description. + * @return Description. + */ + public String getDescription() { return _description; } - - public String getKeywords() { - return _keywords; + + /** + * Gets the keywords/classification. + * @return Keywords/classification + */ + public String getKeywords() { + return _keywords; } - - public TimeInterval getInterval() { - return _interval; + + /** + * Gets the time interval. + * @return Time interval. + */ + public TimeInterval getInterval() { + return _interval; } - - public boolean record() throws PageException { - Action record = _programInfo.execute().getAction(RECORD_ACTION); - if ( record == null) { + + /** + * Records the show. + * @return True iff an attempt could be made to record the page. + * @throws PageException In case of problems recording the page. + */ + public boolean record() throws PageException { + Action record = _programInfo.execute().getAction(RECORD_ACTION); + if (record == null) { return false; } - record.execute(); - return true; + record.execute(); + return true; } - - public void accept(Visitor aVisitor) { + + /** + * Accepts the visitor. + * @param aVisitor Visitor. + */ + public void accept(Visitor aVisitor) { aVisitor.visitProgram(this); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return _interval + " - " + _name + " (" + _channel + "/" + _keywords + ")" + "\n" + - (INDENT + _description).replaceAll("\n", "\n" + INDENT); + return _interval + " - " + _name + " (" + _channel + "/" + _keywords + + ")" + "\n" + + (INDENT + _description).replaceAll("\n", "\n" + INDENT); } }