org.hd.d.pg2k.svrCore.vars
Enum EventPeriod

java.lang.Object
  extended by java.lang.Enum<EventPeriod>
      extended by org.hd.d.pg2k.svrCore.vars.EventPeriod
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<EventPeriod>

public enum EventPeriod
extends java.lang.Enum<EventPeriod>

An enumeration of the available event periods from (very) short to (very) long. The actual event interval in milliseconds is available from the period value, as are some subsidiary methods.

Our on-the-wire tunnel (inter-peer) protocol may depend on the value ordinals, so be very careful if altering this enum in any way.


Enum Constant Summary
LONG
           
MEDIUM
           
SHORT
           
VLONG
           
VSHORT
           
 
Field Summary
private  int intervalMs
          The interval for this event period in milliseconds; strictly positive.
 
Method Summary
 int getIntervalMs()
          Get the interval for this event period in milliseconds; strictly positive.
 long getIntervalNumber(long time)
          Compute the interval number given a time in milliseconds within that interval.
 long getIntervalStartTime(long intervalNumber)
          Get start time (ms) of specified interval number.
static EventPeriod valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static EventPeriod[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

VSHORT

public static final EventPeriod VSHORT

SHORT

public static final EventPeriod SHORT

MEDIUM

public static final EventPeriod MEDIUM

LONG

public static final EventPeriod LONG

VLONG

public static final EventPeriod VLONG
Field Detail

intervalMs

private final int intervalMs
The interval for this event period in milliseconds; strictly positive.

Method Detail

values

public static EventPeriod[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (EventPeriod c : EventPeriod.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static EventPeriod valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getIntervalMs

public final int getIntervalMs()
Get the interval for this event period in milliseconds; strictly positive.


getIntervalNumber

public final long getIntervalNumber(long time)
Compute the interval number given a time in milliseconds within that interval. The time passed must be positive.


getIntervalStartTime

public final long getIntervalStartTime(long intervalNumber)
Get start time (ms) of specified interval number. The interval time passed must be positive, and small enough to avoid overflow in the returned time value.


DHD Multimedia Gallery V1.60.69

Copyright (c) 1996-2012, Damon Hart-Davis. All rights reserved.