public final class TimeWindow extends Object
| Modifier and Type | Field and Description |
|---|---|
static SimpleDateFormat |
DATE_FORMAT |
static String |
DATE_PATTERN |
static Pattern |
EDGE_PATTERN |
| Constructor and Description |
|---|
TimeWindow(String name)
Constructs a named time window with no start and end values.
|
TimeWindow(String name,
long start,
long end,
boolean persistent)
Constructs time window instance.
|
TimeWindow(String name,
String start,
String end,
boolean persistent)
Constructs time window instance.
|
TimeWindow(TimeWindow seed)
Constructs anonymous, non-persistent time window with the same start and end values as the seed.
|
| Modifier and Type | Method and Description |
|---|---|
static Comparator<TimeWindow> |
compareByName()
Returns comparator that compares time windows by names.
|
static Comparator |
compareByTime()
Returns comparator that compares time windows by last use times, most recent first.
|
long |
getLastUseTime()
Returns the time in milliseconds when this time window was last selected.
|
long |
getLength()
Returns time window length.
|
long |
getLowerEdge()
Returns the current value of the lower edge of this window, in milliseconds since Epoch.
|
long |
getLowerEdge(long currentTime)
Returns the lower edge of this time window at the specified time, in milliseconds since Epoch.
|
long |
getLowerEdgeDelay()
Returns the difference between the lower edge of this time window and the current time, in milliseconds.
|
String |
getLowerEdgeString()
Returns the lower edge of this time window in standard format.
|
String |
getName()
Returns the name of this time window.
|
long |
getUpperEdge()
Returns the current value of the upper edge of this window, in milliseconds since Epoch.
|
long |
getUpperEdge(long currentTime)
Returns the upper edge of this time window at the specified time, in milliseconds since Epoch.
|
long |
getUpperEdgeDelay()
Returns the difference between the upper edge of this time window and the current time, in milliseconds.
|
String |
getUpperEdgeString()
Returns the upper edge of this time window in standard format.
|
boolean |
isFixed()
Returns true if both edges do not depend on current time.
|
boolean |
isLowerEdgeFixed()
Returns true if lower edge does not depend on current time.
|
boolean |
isPersistent()
Returns true if this time window should be persisted between sessions.
|
boolean |
isUpperEdgeFixed()
Returns true if upper edge does not depend on current time.
|
static TimeWindow |
parseCompressedString(String s)
Parses string representation of this time window used for saving it in application properties.
|
static long |
parseEdge(String edgeString)
Parses string representation of a time window edge in standard format.
|
void |
setLowerEdge(String edge)
Sets lower edge of this time window.
|
void |
setName(String name)
Sets the name of this time window.
|
void |
setPersistent(boolean persistent)
Sets the flag that indicate whether or not this time window should be persisted between sessions.
|
void |
setUpperEdge(String edge)
Sets upper edge of this time window.
|
String |
toCompressedString()
Returns string representation of this time window used for saving it in application properties.
|
String |
toString()
Returns user-readable string representation of this time window.
|
void |
touch()
Sets the time when this time window was last selected to the current system time.
|
public static final String DATE_PATTERN
public static final SimpleDateFormat DATE_FORMAT
public static final Pattern EDGE_PATTERN
public TimeWindow(String name, long start, long end, boolean persistent)
name - Time window name.start - Time window start, in seconds since Epoch.end - Time window end, in seconds since Epoch.persistent - True is this time window will be persisted between console sessions.IllegalArgumentException - If the combination of arguments is illegal.public TimeWindow(String name, String start, String end, boolean persistent)
name - Time window name.start - Time window start, in standard format.end - Time window end, in standard format.persistent - True is this time window will be persisted between console sessions.IllegalArgumentException - If the combination of arguments is illegal, or the strings cannot be parsed.public TimeWindow(String name)
name - Time window name.public TimeWindow(TimeWindow seed)
seed - Time window that provides start and end values.public String getName()
public void setName(String name)
public boolean isFixed()
public boolean isLowerEdgeFixed()
public boolean isUpperEdgeFixed()
public long getLowerEdgeDelay()
public long getUpperEdgeDelay()
public long getLowerEdge()
public long getUpperEdge()
public long getLowerEdge(long currentTime)
public long getUpperEdge(long currentTime)
public String getLowerEdgeString()
public String getUpperEdgeString()
public void setLowerEdge(String edge)
edge - Edge value in standard format.IllegalArgumentException - if the specified string is not in standard format.public void setUpperEdge(String edge)
edge - Edge value in standard format.IllegalArgumentException - if the specified string is not in standard format.public long getLength()
public boolean isPersistent()
public void setPersistent(boolean persistent)
public long getLastUseTime()
public void touch()
public String toString()
public String toCompressedString()
public static long parseEdge(String edgeString)
public static TimeWindow parseCompressedString(String s)
public static Comparator<TimeWindow> compareByName()
public static Comparator compareByTime()
Copyright © 2023 LSST. All rights reserved.