package org.wamblee.crawler.kiss;
+import java.util.Comparator;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wamblee.crawler.Action;
*/
public class Program {
+ public static class TimeSorter implements Comparator<Program> {
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(T, T)
+ */
+ public int compare(Program o1, Program o2) {
+ return o1.getInterval().getBegin().compareTo(o2.getInterval().getBegin());
+ }
+ }
+
private static final Log LOG = LogFactory.getLog(Program.class);
/**
public TimeInterval getInterval() {
return _interval;
}
+
+ /**
+ * Checks if recording is possible.
+ * @return True iff recording is possible.
+ */
+ public boolean isRecordingPossible() {
+ try {
+ Action record = _programInfo.execute().getAction(RECORD_ACTION);
+ if (record == null) {
+ return false;
+ }
+ return true;
+ } catch (PageException e) {
+ return false;
+ }
+ }
/**
* Records the show.
+ ")" + "\n"
+ (INDENT + _description).replaceAll("\n", "\n" + INDENT);
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if ( !(obj instanceof Program)) {
+ return false;
+ }
+ Program program = (Program)obj;
+ return getName().equals(program.getName()) &&
+ _programInfo.equals(program._programInfo);
+ }
}