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 final Collection<? extends EOPEntry> data;
114 synchronized (this) {
115 data = eopMap.computeIfAbsent(conventions, c -> eopSupplier.apply(c, this));
116 }
117 return new EOPHistory(conventions, EOPHistory.DEFAULT_INTERPOLATION_DEGREE,
118 data, simpleEOP, this);
119 }
120
121 @Override
122 public TTScale getTT() {
123 return tt;
124 }
125
126 @Override
127 public GalileoScale getGST() {
128 return gst;
129 }
130
131 @Override
132 public GLONASSScale getGLONASS() {
133 return glonass;
134 }
135
136 @Override
137 public QZSSScale getQZSS() {
138 return qzss;
139 }
140
141 @Override
142 public GPSScale getGPS() {
143 return gps;
144 }
145
146 @Override
147 public TCGScale getTCG() {
148 return tcg;
149 }
150
151 @Override
152 public TDBScale getTDB() {
153 return tdb;
154 }
155
156 @Override
157 public TCBScale getTCB() {
158 return tcb;
159 }
160
161 @Override
162 public IRNSSScale getIRNSS() {
163 return irnss;
164 }
165
166 @Override
167 public BDTScale getBDT() {
168 return bdt;
169 }
170
171 }
172