1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.time;
18
19 import java.util.Collection;
20 import java.util.concurrent.ConcurrentHashMap;
21 import java.util.concurrent.ConcurrentMap;
22 import java.util.function.BiFunction;
23
24 import org.orekit.frames.EOPEntry;
25 import org.orekit.frames.EOPHistory;
26 import org.orekit.utils.IERSConventions;
27
28
29
30
31
32
33
34
35
36
37 class PreloadedTimeScales extends AbstractTimeScales {
38
39
40 private final TAIScale tai;
41
42 private final UTCScale utc;
43
44 private final TTScale tt;
45
46 private final GalileoScale gst;
47
48 private final GLONASSScale glonass;
49
50 private final QZSSScale qzss;
51
52 private final GPSScale gps;
53
54 private final TCGScale tcg;
55
56 private final TDBScale tdb;
57
58 private final TCBScale tcb;
59
60 private final IRNSSScale irnss;
61
62 private final BDTScale bdt;
63
64 private final BiFunction<
65 ? super IERSConventions,
66 ? super TimeScales,
67 ? extends Collection<? extends EOPEntry>> eopSupplier;
68
69 private final ConcurrentMap<IERSConventions, Collection<? extends EOPEntry>> eopMap;
70
71
72
73
74
75
76
77 PreloadedTimeScales(
78 final Collection<? extends OffsetModel> leapSeconds,
79 final BiFunction<
80 ? super IERSConventions,
81 ? super TimeScales,
82 ? extends Collection<? extends EOPEntry>> eopSupplier) {
83 tai = new TAIScale();
84 tt = new TTScale();
85 gps = new GPSScale();
86 qzss = new QZSSScale();
87 gst = new GalileoScale();
88 irnss = new IRNSSScale();
89 bdt = new BDTScale();
90 tcg = new TCGScale(tt, tai);
91 utc = new UTCScale(tai, leapSeconds);
92 glonass = new GLONASSScale(utc);
93 tdb = new TDBScale(tt, getJ2000Epoch());
94 tcb = new TCBScale(tdb, tai);
95 final int n = IERSConventions.values().length;
96 eopMap = new ConcurrentHashMap<>(n);
97 this.eopSupplier = eopSupplier;
98 }
99
100 @Override
101 public TAIScale getTAI() {
102 return tai;
103 }
104
105 @Override
106 public UTCScale getUTC() {
107 return utc;
108 }
109
110 @Override
111 protected EOPHistory getEopHistory(final IERSConventions conventions,
112 final boolean simpleEOP) {
113 return new EOPHistory(conventions, EOPHistory.DEFAULT_INTERPOLATION_DEGREE,
114 eopMap.computeIfAbsent(conventions, c -> eopSupplier.apply(c, this)),
115 simpleEOP,
116 this);
117 }
118
119 @Override
120 public TTScale getTT() {
121 return tt;
122 }
123
124 @Override
125 public GalileoScale getGST() {
126 return gst;
127 }
128
129 @Override
130 public GLONASSScale getGLONASS() {
131 return glonass;
132 }
133
134 @Override
135 public QZSSScale getQZSS() {
136 return qzss;
137 }
138
139 @Override
140 public GPSScale getGPS() {
141 return gps;
142 }
143
144 @Override
145 public TCGScale getTCG() {
146 return tcg;
147 }
148
149 @Override
150 public TDBScale getTDB() {
151 return tdb;
152 }
153
154 @Override
155 public TCBScale getTCB() {
156 return tcb;
157 }
158
159 @Override
160 public IRNSSScale getIRNSS() {
161 return irnss;
162 }
163
164 @Override
165 public BDTScale getBDT() {
166 return bdt;
167 }
168
169 }
170