com.moneydance.apps.md.model.time
Enum TimeInterval
java.lang.Object
java.lang.Enum<TimeInterval>
com.moneydance.apps.md.model.time.TimeInterval
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<TimeInterval>
public enum TimeInterval
- extends java.lang.Enum<TimeInterval>
Represents a time or calendar interval of a specified duration. Replaces the former
GraphDataSet
and
BudgetReport
constants:
public static final char DAY_INTERVAL = 'd';
public static final char WEEK_INTERVAL = 'w';
public static final char MONTH_INTERVAL = 'm';
public static final char YEAR_INTERVAL = 'y';
private static final int GROUP_BY_NONE = 0;
private static final int GROUP_BY_WEEK = 1;
private static final int GROUP_BY_MONTH = 2;
private static final int GROUP_BY_QTR = 3;
private static final int GROUP_BY_YEAR = 4;
- Author:
- Kevin Menningen - Mennē Software Solutions, LLC
Field Summary |
static TimeInterval |
DEFAULT
The default is a monthly interval because that is the most popular. |
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 |
NONE
public static final TimeInterval NONE
DAY
public static final TimeInterval DAY
WEEK
public static final TimeInterval WEEK
MONTH
public static final TimeInterval MONTH
QUARTER
public static final TimeInterval QUARTER
YEAR
public static final TimeInterval YEAR
DEFAULT
public static final TimeInterval DEFAULT
- The default is a monthly interval because that is the most popular.
values
public static TimeInterval[] 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 (TimeInterval c : TimeInterval.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they are declared
valueOf
public static TimeInterval 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
getId
public char getId()
- Returns:
- The id used in URLs to identify this time interval.
getValue
public int getValue()
- Returns:
- The numeric value of the time interval. Not the same as the ordinal.
getConfigKey
public java.lang.String getConfigKey()
- Returns:
- The string key for configuration settings/URLs. See
getId()
.
getGroupResourceKey
public java.lang.String getGroupResourceKey()
- Returns:
- The resource key for showing 'Group By' time interval string.
getSubtotalResourceKey
public java.lang.String getSubtotalResourceKey()
- Returns:
- The resource key for showing 'Subtotal By' time interval string.
getDivisorResourceKey
public java.lang.String getDivisorResourceKey()
- Returns:
- The resource key for showing the time interval like 'Daily' or 'Weekly'.
fromChar
public static TimeInterval fromChar(char identifier)
- Derive a time interval from a character, probably stored in settings. Originally time
intervals were stored in URLs by index, which meant you could not add new intervals easily.
This method first checks to see if the character matches the new (non-numeric) intervals,
then failing that will convert an integer using the ordinals (which may or may not match
up correctly). If all else fails then it will return the
DEFAULT
interval.
- Parameters:
identifier
- The character to convert to a time interval.
- Returns:
- The corresponding time interval.