public class DefaultTimeDomainCatalog extends ImmutableTimeDomainCatalog
The domains provided by this catalog have the following labels:
There are different ways to access a time domain. If the catalog is
implemented correctly, all methods should give the same object. Because time
domains are immutable it is not wrong in principle to use different objects
for the same time domain, but it has performance consequences. As an example,
Observation encapsulates a time domain and processing observations
often involves comparing their time domains with #equals. As applications can
have thousands or even millions of observations, using the same object for
the same time domain makes applications faster. The following example code
shows 4 different ways to get the same domain object, in this case the
daily domain implemented by
TimeDomainCatalog catalog = new DefaultTimeDomainCatalog(); TimeDomain d1 = new Day("0102-03-04").getTimeDomain(); TimeDomain d2 = Day.DOMAIN; TimeDomain d3 = catalog.get("daily"); TimeDomain d4 = catalog.get(new TimeDomainDefinition(null, Resolution.DAY, 0L)); assertSame(d1, d2); assertSame(d1, d3); assertSame(d1, d4);
|Constructor and Description|
Construct a DefaultTimeDomainCatalog.
Copyright © 2017. All rights reserved.