org.jmythapi.protocol.response.impl
Class AFlagGroup<E extends Enum<E> & IFlag>

java.lang.Object
  extended by java.lang.Number
      extended by org.jmythapi.protocol.response.impl.AGroup<E>
          extended by org.jmythapi.protocol.response.impl.AFlagGroup<E>
All Implemented Interfaces:
Serializable, Cloneable, Formattable, IVersionable, IFlagGroup<E>, IGroup<E>
Direct Known Subclasses:
ProgramAudioProperties, ProgramFlags, ProgramRecordingDupInType, ProgramRecordingDupMethodType, ProgramSubtitleType, ProgramVideoProperties, RemoteEncoderFlags, SleepStatus

public abstract class AFlagGroup<E extends Enum<E> & IFlag>
extends AGroup<E>
implements IVersionable, IFlagGroup<E>

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jmythapi.protocol.response.impl.AGroup
groupClass, logger, longValue, protoVersion
 
Constructor Summary
AFlagGroup(Class<E> groupClass, ProtocolVersion protoVersion, long enumValue)
           
 
Method Summary
 EnumSet<E> getActiveFlags()
          Gets all currently active flags of this group.
 EnumMap<E,Boolean> getFlagMap()
          Gets a map with all flags and their isSet status.
static
<E extends Enum<E> & IFlag>
Long
getFlagValue(ProtocolVersion protoVersion, E flag)
          Gets the long value of the given flag.
 EnumSet<E> getInactiveFlags()
          Gets all currently inactive flags of this group.
 EnumSet<E> getSupportedFlags()
          Gets all possible flags of this flag group.
static
<E extends Enum<E> & IFlag>
EnumSet<E>
getSupportedFlags(Class<E> groupClass, ProtocolVersion protoVersion)
           
 boolean isSet(E flag)
          Checks if the given flag is actually set.
 boolean isSupportedFlag(E flag)
           
 String toString()
          Calculates a string representation of this flag-group.
static
<E extends Enum<E> & IFlag,G extends AGroup<E>>
G
valueOf(Class<G> groupClass, ProtocolVersion protoVersion, E... flags)
           
 
Methods inherited from class org.jmythapi.protocol.response.impl.AGroup
clone, createObject, doubleValue, equals, floatValue, formatTo, getGroupClass, getVersionNr, hashCode, intValue, longValue, valueOf, valueOf, valueOf
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jmythapi.protocol.response.IGroup
getGroupClass, longValue
 
Methods inherited from interface org.jmythapi.IVersionable
getVersionNr
 

Constructor Detail

AFlagGroup

public AFlagGroup(Class<E> groupClass,
                  ProtocolVersion protoVersion,
                  long enumValue)
Method Detail

getSupportedFlags

public EnumSet<E> getSupportedFlags()
Description copied from interface: IFlagGroup
Gets all possible flags of this flag group.

Specified by:
getSupportedFlags in interface IFlagGroup<E extends Enum<E> & IFlag>
Returns:
all possible flags

getActiveFlags

public EnumSet<E> getActiveFlags()
Description copied from interface: IFlagGroup
Gets all currently active flags of this group.

Specified by:
getActiveFlags in interface IFlagGroup<E extends Enum<E> & IFlag>
Returns:
all active flags.

getInactiveFlags

public EnumSet<E> getInactiveFlags()
Description copied from interface: IFlagGroup
Gets all currently inactive flags of this group.

Specified by:
getInactiveFlags in interface IFlagGroup<E extends Enum<E> & IFlag>
Returns:
all inactive flags.

isSupportedFlag

public boolean isSupportedFlag(E flag)

isSet

public boolean isSet(E flag)
Description copied from interface: IFlagGroup
Checks if the given flag is actually set.

Specified by:
isSet in interface IFlagGroup<E extends Enum<E> & IFlag>
Parameters:
flag - the flag to check
Returns:
true if the flag is currently set.

getFlagMap

public EnumMap<E,Boolean> getFlagMap()
Description copied from interface: IFlagGroup
Gets a map with all flags and their isSet status.

Specified by:
getFlagMap in interface IFlagGroup<E extends Enum<E> & IFlag>
Returns:
a map with all flags and boolean value indicating if a given flag is set.

getFlagValue

public static <E extends Enum<E> & IFlag> Long getFlagValue(ProtocolVersion protoVersion,
                                                           E flag)
Gets the long value of the given flag.

If the given flag is of type IVersionableValue then IVersionableValue.getValue(ProtocolVersion) is used to determine the flag value, otherwise IFlag.getFlagValue() is used.

Depending of the given protocol version, the returned value may be different.

Returns:
the long value of the given flag or null if the flag object was null.

getSupportedFlags

public static <E extends Enum<E> & IFlag> EnumSet<E> getSupportedFlags(Class<E> groupClass,
                                                                      ProtocolVersion protoVersion)

valueOf

public static <E extends Enum<E> & IFlag,G extends AGroup<E>> G valueOf(Class<G> groupClass,
                                                                       ProtocolVersion protoVersion,
                                                                       E... flags)

toString

public String toString()

Calculates a string representation of this flag-group.

E.g.
4=> {FL_AUTOEXP}

Overrides:
toString in class Object


Copyright © 2008-2013. All Rights Reserved.