org.jmythapi.protocol.response.impl
Class RecordingsPending

java.lang.Object
  extended by org.jmythapi.impl.AData<E>
      extended by org.jmythapi.protocol.response.impl.AMythResponse<E>
          extended by org.jmythapi.protocol.response.impl.ARecordings<IRecordingsPending.Props>
              extended by org.jmythapi.protocol.response.impl.RecordingsPending
All Implemented Interfaces:
Cloneable, Iterable<IProgramInfo>, IPropertyAware<IRecordingsPending.Props>, IVersionable, ISendable, IMythResponse<IRecordingsPending.Props>, IRecordings, IRecordingsPending

public class RecordingsPending
extends ARecordings<IRecordingsPending.Props>
implements IRecordingsPending


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jmythapi.protocol.response.IRecordingsPending
IRecordingsPending.Props
 
Field Summary
 
Fields inherited from class org.jmythapi.impl.AData
logger, propsClass, protoVersion, respArgs
 
Constructor Summary
RecordingsPending(IMythPacket packet)
           
RecordingsPending(ProtocolVersion protoVersion, List<String> responseArgs)
           
 
Method Summary
static RecordingsPending emptyList(ProtocolVersion protoVersion)
          Creates a new empty list
 int getConflictsCount()
          Gets the amount of conflicts between all pending recordings.
 int getMinutesToNextRecording()
          Gets the minutes to the next pending recording.
 Date getNextPendingRecordingDate()
          Gets the date of the next pending recording.
 Map<Integer,IProgramInfo> getNextPendingRecordings()
          This function returns the earliest pending recording for each recorder.
 Map<Integer,Date> getNextPendingRecordingsDates()
          This function returns the earliest recording-start time for each recorder.
protected  int getSizePropertyIndex()
           
 boolean hasConflicts()
          Checks if there are any conflicts between all pending recordings.
static RecordingsPending valueOf(IProgramInfoList programs)
          Creates a new pending recordings list from a program list.
 
Methods inherited from class org.jmythapi.protocol.response.impl.ARecordings
getExpectedSize, getProgramInfoList, getProgramInfoList, isEmpty, iterator, iterator, size, toString
 
Methods inherited from class org.jmythapi.protocol.response.impl.AMythResponse
checkSize, decodeProperty, encodeProperty, getPacket, getProperties, getProperty, getPropertyIndex
 
Methods inherited from class org.jmythapi.impl.AData
clone, equals, getPropertyClass, getPropertyCount, getPropertyMap, getPropertyValue, getPropertyValue, getPropertyValueObject, getPropertyValueObject, getPropertyValues, getVersionNr, hashCode, init, postProcessArguments, setPropertyValue, setPropertyValue, setPropertyValueObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jmythapi.protocol.response.IRecordings
getProgramInfoList, getProgramInfoList, isEmpty, iterator, iterator, size
 
Methods inherited from interface org.jmythapi.IVersionable
getVersionNr
 
Methods inherited from interface org.jmythapi.IPropertyAware
getProperties, getProperty, getPropertyClass, getPropertyCount, getPropertyIndex, getPropertyMap, getPropertyValue, getPropertyValue, getPropertyValueObject, getPropertyValues, setPropertyValue, setPropertyValue, setPropertyValueObject
 

Constructor Detail

RecordingsPending

public RecordingsPending(IMythPacket packet)

RecordingsPending

public RecordingsPending(ProtocolVersion protoVersion,
                         List<String> responseArgs)
Method Detail

hasConflicts

public boolean hasConflicts()
Description copied from interface: IRecordingsPending
Checks if there are any conflicts between all pending recordings.

Specified by:
hasConflicts in interface IRecordingsPending
Returns:
true if there are any conflicts

getConflictsCount

public int getConflictsCount()
Description copied from interface: IRecordingsPending
Gets the amount of conflicts between all pending recordings.

Specified by:
getConflictsCount in interface IRecordingsPending
Returns:
how many conflicts were detected between the pending recordings

getSizePropertyIndex

protected int getSizePropertyIndex()
Specified by:
getSizePropertyIndex in class ARecordings<IRecordingsPending.Props>
Returns:
the position within the response-arguments where the size property is located

getNextPendingRecordings

public Map<Integer,IProgramInfo> getNextPendingRecordings()
Description copied from interface: IRecordingsPending
This function returns the earliest pending recording for each recorder.

Specified by:
getNextPendingRecordings in interface IRecordingsPending
Returns:
a map containing the recorder-id as key and the earliest next recording as value.

getNextPendingRecordingsDates

public Map<Integer,Date> getNextPendingRecordingsDates()
Description copied from interface: IRecordingsPending
This function returns the earliest recording-start time for each recorder.

Usage example:


 
       IBackend backend = ....;     // an already connected backend
       
       // get all pending recordings
       IRecordingsPending pendingRecords = backend.queryAllPending();
       
       // get next recording start times
       Map<Integer,Date> nextRecordingDates = pendingRecords.getNextPendingRecordingDates();
       for(Entry<Integer,Date> nextRecordingDate : nextRecordingDates.entrySet()) {
          System.out.println(String.format(
             "Recorder %02d will start a recording at %2$tF %2$tT.",
             nextRecordingDate.getKey(),
             nextRecordingDate.getValue()
          ));
       }
  

Specified by:
getNextPendingRecordingsDates in interface IRecordingsPending
Returns:
a map containing the recorder-id as key and the start-time of the earliest next recording as value. If there is no pending recording an empty map is returned.
See Also:
IRecordingsPending.getNextPendingRecordings()

getNextPendingRecordingDate

public Date getNextPendingRecordingDate()
Description copied from interface: IRecordingsPending
Gets the date of the next pending recording.

Specified by:
getNextPendingRecordingDate in interface IRecordingsPending
Returns:
the date of the next pending recording or null if there is no pending recording.

getMinutesToNextRecording

public int getMinutesToNextRecording()
Description copied from interface: IRecordingsPending
Gets the minutes to the next pending recording.

Specified by:
getMinutesToNextRecording in interface IRecordingsPending
Returns:
the minutes to the next pending recording or -1 if there is no pending recording.

valueOf

public static final RecordingsPending valueOf(IProgramInfoList programs)
Creates a new pending recordings list from a program list.

Parameters:
programs - the program list
Returns:
the pending recordings list

emptyList

public static final RecordingsPending emptyList(ProtocolVersion protoVersion)
Creates a new empty list

Parameters:
protoVersion - the protocol version to use
Returns:
the empty list


Copyright © 2008-2013. All Rights Reserved.