public interface TimeGrain extends Granularity
Modifier and Type | Method and Description |
---|---|
default boolean |
accepts(Collection<org.joda.time.Interval> intervals)
Determine if all intervals align with a granularity.
|
boolean |
aligns(org.joda.time.DateTime dateTime)
Determines if this dateTime falls on a time grain boundary.
|
default boolean |
aligns(org.joda.time.Interval interval)
Determines if this interval corresponds with time grain boundaries.
|
String |
getAlignmentDescription()
Get description of correct alignment of a granularity, e.g.
|
org.joda.time.Duration |
getEstimatedDuration()
Estimated duration gives a rough millisecond length of the TimeGrain usable for comparison.
|
String |
getName()
Get the name of the granularity.
|
org.joda.time.ReadablePeriod |
getPeriod()
Get the Period of the TimeGrain.
|
String |
getPeriodString()
Period string to use when serializing.
|
String |
getType()
Type of Granularity to use when serializing.
|
default Iterator<org.joda.time.Interval> |
intervalsIterator(SimplifiedIntervalList intervals)
Build an iterator from a pre-simplified list of intervals.
|
default org.joda.time.DateTime |
roundCeiling(org.joda.time.DateTime dateTime)
Round the DateTime to the "front edge" (ie.
|
org.joda.time.DateTime |
roundFloor(org.joda.time.DateTime dateTime)
Given a date time find the first instant at or before that date time which starts a time grain.
|
default boolean |
satisfiedBy(Granularity that)
Determine if this granularity can be fulfilled by an aggregate of another granularity.
|
boolean |
satisfiedBy(TimeGrain grain)
True if the argument grain can be used to build this grain.
|
String |
toString() |
intervalsIterable, intervalsIterator, satisfies
String getType()
String getPeriodString()
org.joda.time.DateTime roundFloor(org.joda.time.DateTime dateTime)
dateTime
- The time being roundeddefault org.joda.time.DateTime roundCeiling(org.joda.time.DateTime dateTime)
dateTime
- DateTime to roundorg.joda.time.ReadablePeriod getPeriod()
String getName()
Granularity
getName
in interface Granularity
String getAlignmentDescription()
Granularity
getAlignmentDescription
in interface Granularity
boolean satisfiedBy(TimeGrain grain)
grain
- The grain being testeddefault boolean satisfiedBy(Granularity that)
Granularity
satisfiedBy
in interface Granularity
that
- The granularity to be compared againstorg.joda.time.Duration getEstimatedDuration()
boolean aligns(org.joda.time.DateTime dateTime)
dateTime
- A date time to test against the time grain boundarydefault boolean aligns(org.joda.time.Interval interval)
interval
- An interval to test against the time grain boundarydefault boolean accepts(Collection<org.joda.time.Interval> intervals)
Granularity
accepts
in interface Granularity
intervals
- The collection of intervals that should be checkeddefault Iterator<org.joda.time.Interval> intervalsIterator(SimplifiedIntervalList intervals)
Granularity
intervalsIterator
in interface Granularity
intervals
- The intervals as a simplified interval listGranularity.intervalsIterator(Collection)
Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.