astro.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /************************************************************************
  4. * Copyright (C) 1996-2008, International Business Machines Corporation *
  5. * and others. All Rights Reserved. *
  6. ************************************************************************
  7. * 2003-nov-07 srl Port from Java
  8. */
  9. #ifndef ASTRO_H
  10. #define ASTRO_H
  11. #include "unicode/utypes.h"
  12. #if !UCONFIG_NO_FORMATTING
  13. #include "gregoimp.h" // for Math
  14. #include "unicode/unistr.h"
  15. U_NAMESPACE_BEGIN
  16. /**
  17. * <code>CalendarAstronomer</code> is a class that can perform the calculations to
  18. * determine the positions of the sun and moon, the time of sunrise and
  19. * sunset, and other astronomy-related data. The calculations it performs
  20. * are in some cases quite complicated, and this utility class saves you
  21. * the trouble of worrying about them.
  22. * <p>
  23. * The measurement of time is a very important part of astronomy. Because
  24. * astronomical bodies are constantly in motion, observations are only valid
  25. * at a given moment in time. Accordingly, each <code>CalendarAstronomer</code>
  26. * object has a <code>time</code> property that determines the date
  27. * and time for which its calculations are performed. You can set and
  28. * retrieve this property with {@link #setDate setDate}, {@link #getDate getDate}
  29. * and related methods.
  30. * <p>
  31. * Almost all of the calculations performed by this class, or by any
  32. * astronomer, are approximations to various degrees of accuracy. The
  33. * calculations in this class are mostly modelled after those described
  34. * in the book
  35. * <a href="http://www.amazon.com/exec/obidos/ISBN=0521356997" target="_top">
  36. * Practical Astronomy With Your Calculator</a>, by Peter J.
  37. * Duffett-Smith, Cambridge University Press, 1990. This is an excellent
  38. * book, and if you want a greater understanding of how these calculations
  39. * are performed it a very good, readable starting point.
  40. * <p>
  41. * <strong>WARNING:</strong> This class is very early in its development, and
  42. * it is highly likely that its API will change to some degree in the future.
  43. * At the moment, it basically does just enough to support {@link IslamicCalendar}
  44. * and {@link ChineseCalendar}.
  45. *
  46. * @author Laura Werner
  47. * @author Alan Liu
  48. * @internal
  49. */
  50. class U_I18N_API CalendarAstronomer : public UMemory {
  51. public:
  52. // some classes
  53. public:
  54. /**
  55. * Represents the position of an object in the sky relative to the ecliptic,
  56. * the plane of the earth's orbit around the Sun.
  57. * This is a spherical coordinate system in which the latitude
  58. * specifies the position north or south of the plane of the ecliptic.
  59. * The longitude specifies the position along the ecliptic plane
  60. * relative to the "First Point of Aries", which is the Sun's position in the sky
  61. * at the Vernal Equinox.
  62. * <p>
  63. * Note that Ecliptic objects are immutable and cannot be modified
  64. * once they are constructed. This allows them to be passed and returned by
  65. * value without worrying about whether other code will modify them.
  66. *
  67. * @see CalendarAstronomer.Equatorial
  68. * @see CalendarAstronomer.Horizon
  69. * @internal
  70. */
  71. class U_I18N_API Ecliptic : public UMemory {
  72. public:
  73. /**
  74. * Constructs an Ecliptic coordinate object.
  75. * <p>
  76. * @param lat The ecliptic latitude, measured in radians.
  77. * @param lon The ecliptic longitude, measured in radians.
  78. * @internal
  79. */
  80. Ecliptic(double lat = 0, double lon = 0) {
  81. latitude = lat;
  82. longitude = lon;
  83. }
  84. /**
  85. * Setter for Ecliptic Coordinate object
  86. * @param lat The ecliptic latitude, measured in radians.
  87. * @param lon The ecliptic longitude, measured in radians.
  88. * @internal
  89. */
  90. void set(double lat, double lon) {
  91. latitude = lat;
  92. longitude = lon;
  93. }
  94. /**
  95. * Return a string representation of this object
  96. * @internal
  97. */
  98. UnicodeString toString() const;
  99. /**
  100. * The ecliptic latitude, in radians. This specifies an object's
  101. * position north or south of the plane of the ecliptic,
  102. * with positive angles representing north.
  103. * @internal
  104. */
  105. double latitude;
  106. /**
  107. * The ecliptic longitude, in radians.
  108. * This specifies an object's position along the ecliptic plane
  109. * relative to the "First Point of Aries", which is the Sun's position
  110. * in the sky at the Vernal Equinox,
  111. * with positive angles representing east.
  112. * <p>
  113. * A bit of trivia: the first point of Aries is currently in the
  114. * constellation Pisces, due to the precession of the earth's axis.
  115. * @internal
  116. */
  117. double longitude;
  118. };
  119. /**
  120. * Represents the position of an
  121. * object in the sky relative to the plane of the earth's equator.
  122. * The <i>Right Ascension</i> specifies the position east or west
  123. * along the equator, relative to the sun's position at the vernal
  124. * equinox. The <i>Declination</i> is the position north or south
  125. * of the equatorial plane.
  126. * <p>
  127. * Note that Equatorial objects are immutable and cannot be modified
  128. * once they are constructed. This allows them to be passed and returned by
  129. * value without worrying about whether other code will modify them.
  130. *
  131. * @see CalendarAstronomer.Ecliptic
  132. * @see CalendarAstronomer.Horizon
  133. * @internal
  134. */
  135. class U_I18N_API Equatorial : public UMemory {
  136. public:
  137. /**
  138. * Constructs an Equatorial coordinate object.
  139. * <p>
  140. * @param asc The right ascension, measured in radians.
  141. * @param dec The declination, measured in radians.
  142. * @internal
  143. */
  144. Equatorial(double asc = 0, double dec = 0)
  145. : ascension(asc), declination(dec) { }
  146. /**
  147. * Setter
  148. * @param asc The right ascension, measured in radians.
  149. * @param dec The declination, measured in radians.
  150. * @internal
  151. */
  152. void set(double asc, double dec) {
  153. ascension = asc;
  154. declination = dec;
  155. }
  156. /**
  157. * Return a string representation of this object, with the
  158. * angles measured in degrees.
  159. * @internal
  160. */
  161. UnicodeString toString() const;
  162. /**
  163. * Return a string representation of this object with the right ascension
  164. * measured in hours, minutes, and seconds.
  165. * @internal
  166. */
  167. //String toHmsString() {
  168. //return radToHms(ascension) + "," + radToDms(declination);
  169. //}
  170. /**
  171. * The right ascension, in radians.
  172. * This is the position east or west along the equator
  173. * relative to the sun's position at the vernal equinox,
  174. * with positive angles representing East.
  175. * @internal
  176. */
  177. double ascension;
  178. /**
  179. * The declination, in radians.
  180. * This is the position north or south of the equatorial plane,
  181. * with positive angles representing north.
  182. * @internal
  183. */
  184. double declination;
  185. };
  186. /**
  187. * Represents the position of an object in the sky relative to
  188. * the local horizon.
  189. * The <i>Altitude</i> represents the object's elevation above the horizon,
  190. * with objects below the horizon having a negative altitude.
  191. * The <i>Azimuth</i> is the geographic direction of the object from the
  192. * observer's position, with 0 representing north. The azimuth increases
  193. * clockwise from north.
  194. * <p>
  195. * Note that Horizon objects are immutable and cannot be modified
  196. * once they are constructed. This allows them to be passed and returned by
  197. * value without worrying about whether other code will modify them.
  198. *
  199. * @see CalendarAstronomer.Ecliptic
  200. * @see CalendarAstronomer.Equatorial
  201. * @internal
  202. */
  203. class U_I18N_API Horizon : public UMemory {
  204. public:
  205. /**
  206. * Constructs a Horizon coordinate object.
  207. * <p>
  208. * @param alt The altitude, measured in radians above the horizon.
  209. * @param azim The azimuth, measured in radians clockwise from north.
  210. * @internal
  211. */
  212. Horizon(double alt=0, double azim=0)
  213. : altitude(alt), azimuth(azim) { }
  214. /**
  215. * Setter for Ecliptic Coordinate object
  216. * @param alt The altitude, measured in radians above the horizon.
  217. * @param azim The azimuth, measured in radians clockwise from north.
  218. * @internal
  219. */
  220. void set(double alt, double azim) {
  221. altitude = alt;
  222. azimuth = azim;
  223. }
  224. /**
  225. * Return a string representation of this object, with the
  226. * angles measured in degrees.
  227. * @internal
  228. */
  229. UnicodeString toString() const;
  230. /**
  231. * The object's altitude above the horizon, in radians.
  232. * @internal
  233. */
  234. double altitude;
  235. /**
  236. * The object's direction, in radians clockwise from north.
  237. * @internal
  238. */
  239. double azimuth;
  240. };
  241. public:
  242. //-------------------------------------------------------------------------
  243. // Assorted private data used for conversions
  244. //-------------------------------------------------------------------------
  245. // My own copies of these so compilers are more likely to optimize them away
  246. static const double PI;
  247. /**
  248. * The average number of solar days from one new moon to the next. This is the time
  249. * it takes for the moon to return the same ecliptic longitude as the sun.
  250. * It is longer than the sidereal month because the sun's longitude increases
  251. * during the year due to the revolution of the earth around the sun.
  252. * Approximately 29.53.
  253. *
  254. * @see #SIDEREAL_MONTH
  255. * @internal
  256. * @deprecated ICU 2.4. This class may be removed or modified.
  257. */
  258. static const double SYNODIC_MONTH;
  259. //-------------------------------------------------------------------------
  260. // Constructors
  261. //-------------------------------------------------------------------------
  262. /**
  263. * Construct a new <code>CalendarAstronomer</code> object that is initialized to
  264. * the current date and time.
  265. * @internal
  266. */
  267. CalendarAstronomer();
  268. /**
  269. * Construct a new <code>CalendarAstronomer</code> object that is initialized to
  270. * the specified date and time.
  271. * @internal
  272. */
  273. CalendarAstronomer(UDate d);
  274. /**
  275. * Construct a new <code>CalendarAstronomer</code> object with the given
  276. * latitude and longitude. The object's time is set to the current
  277. * date and time.
  278. * <p>
  279. * @param longitude The desired longitude, in <em>degrees</em> east of
  280. * the Greenwich meridian.
  281. *
  282. * @param latitude The desired latitude, in <em>degrees</em>. Positive
  283. * values signify North, negative South.
  284. *
  285. * @see java.util.Date#getTime()
  286. * @internal
  287. */
  288. CalendarAstronomer(double longitude, double latitude);
  289. /**
  290. * Destructor
  291. * @internal
  292. */
  293. ~CalendarAstronomer();
  294. //-------------------------------------------------------------------------
  295. // Time and date getters and setters
  296. //-------------------------------------------------------------------------
  297. /**
  298. * Set the current date and time of this <code>CalendarAstronomer</code> object. All
  299. * astronomical calculations are performed based on this time setting.
  300. *
  301. * @param aTime the date and time, expressed as the number of milliseconds since
  302. * 1/1/1970 0:00 GMT (Gregorian).
  303. *
  304. * @see #setDate
  305. * @see #getTime
  306. * @internal
  307. */
  308. void setTime(UDate aTime);
  309. /**
  310. * Set the current date and time of this <code>CalendarAstronomer</code> object. All
  311. * astronomical calculations are performed based on this time setting.
  312. *
  313. * @param aTime the date and time, expressed as the number of milliseconds since
  314. * 1/1/1970 0:00 GMT (Gregorian).
  315. *
  316. * @see #getTime
  317. * @internal
  318. */
  319. void setDate(UDate aDate) { setTime(aDate); }
  320. /**
  321. * Set the current date and time of this <code>CalendarAstronomer</code> object. All
  322. * astronomical calculations are performed based on this time setting.
  323. *
  324. * @param jdn the desired time, expressed as a "julian day number",
  325. * which is the number of elapsed days since
  326. * 1/1/4713 BC (Julian), 12:00 GMT. Note that julian day
  327. * numbers start at <em>noon</em>. To get the jdn for
  328. * the corresponding midnight, subtract 0.5.
  329. *
  330. * @see #getJulianDay
  331. * @see #JULIAN_EPOCH_MS
  332. * @internal
  333. */
  334. void setJulianDay(double jdn);
  335. /**
  336. * Get the current time of this <code>CalendarAstronomer</code> object,
  337. * represented as the number of milliseconds since
  338. * 1/1/1970 AD 0:00 GMT (Gregorian).
  339. *
  340. * @see #setTime
  341. * @see #getDate
  342. * @internal
  343. */
  344. UDate getTime();
  345. /**
  346. * Get the current time of this <code>CalendarAstronomer</code> object,
  347. * expressed as a "julian day number", which is the number of elapsed
  348. * days since 1/1/4713 BC (Julian), 12:00 GMT.
  349. *
  350. * @see #setJulianDay
  351. * @see #JULIAN_EPOCH_MS
  352. * @internal
  353. */
  354. double getJulianDay();
  355. /**
  356. * Return this object's time expressed in julian centuries:
  357. * the number of centuries after 1/1/1900 AD, 12:00 GMT
  358. *
  359. * @see #getJulianDay
  360. * @internal
  361. */
  362. double getJulianCentury();
  363. /**
  364. * Returns the current Greenwich sidereal time, measured in hours
  365. * @internal
  366. */
  367. double getGreenwichSidereal();
  368. private:
  369. double getSiderealOffset();
  370. public:
  371. /**
  372. * Returns the current local sidereal time, measured in hours
  373. * @internal
  374. */
  375. double getLocalSidereal();
  376. /**
  377. * Converts local sidereal time to Universal Time.
  378. *
  379. * @param lst The Local Sidereal Time, in hours since sidereal midnight
  380. * on this object's current date.
  381. *
  382. * @return The corresponding Universal Time, in milliseconds since
  383. * 1 Jan 1970, GMT.
  384. */
  385. //private:
  386. double lstToUT(double lst);
  387. /**
  388. *
  389. * Convert from ecliptic to equatorial coordinates.
  390. *
  391. * @param ecliptic The ecliptic
  392. * @param result Fillin result
  393. * @return reference to result
  394. */
  395. Equatorial& eclipticToEquatorial(Equatorial& result, const Ecliptic& ecliptic);
  396. /**
  397. * Convert from ecliptic to equatorial coordinates.
  398. *
  399. * @param eclipLong The ecliptic longitude
  400. * @param eclipLat The ecliptic latitude
  401. *
  402. * @return The corresponding point in equatorial coordinates.
  403. * @internal
  404. */
  405. Equatorial& eclipticToEquatorial(Equatorial& result, double eclipLong, double eclipLat);
  406. /**
  407. * Convert from ecliptic longitude to equatorial coordinates.
  408. *
  409. * @param eclipLong The ecliptic longitude
  410. *
  411. * @return The corresponding point in equatorial coordinates.
  412. * @internal
  413. */
  414. Equatorial& eclipticToEquatorial(Equatorial& result, double eclipLong) ;
  415. /**
  416. * @internal
  417. */
  418. Horizon& eclipticToHorizon(Horizon& result, double eclipLong) ;
  419. //-------------------------------------------------------------------------
  420. // The Sun
  421. //-------------------------------------------------------------------------
  422. /**
  423. * The longitude of the sun at the time specified by this object.
  424. * The longitude is measured in radians along the ecliptic
  425. * from the "first point of Aries," the point at which the ecliptic
  426. * crosses the earth's equatorial plane at the vernal equinox.
  427. * <p>
  428. * Currently, this method uses an approximation of the two-body Kepler's
  429. * equation for the earth and the sun. It does not take into account the
  430. * perturbations caused by the other planets, the moon, etc.
  431. * @internal
  432. */
  433. double getSunLongitude();
  434. /**
  435. * TODO Make this public when the entire class is package-private.
  436. */
  437. /*public*/ void getSunLongitude(double julianDay, double &longitude, double &meanAnomaly);
  438. /**
  439. * The position of the sun at this object's current date and time,
  440. * in equatorial coordinates.
  441. * @param result fillin for the result
  442. * @internal
  443. */
  444. Equatorial& getSunPosition(Equatorial& result);
  445. public:
  446. /**
  447. * Constant representing the vernal equinox.
  448. * For use with {@link #getSunTime getSunTime}.
  449. * Note: In this case, "vernal" refers to the northern hemisphere's seasons.
  450. * @internal
  451. */
  452. // static double VERNAL_EQUINOX();
  453. /**
  454. * Constant representing the summer solstice.
  455. * For use with {@link #getSunTime getSunTime}.
  456. * Note: In this case, "summer" refers to the northern hemisphere's seasons.
  457. * @internal
  458. */
  459. static double SUMMER_SOLSTICE();
  460. /**
  461. * Constant representing the autumnal equinox.
  462. * For use with {@link #getSunTime getSunTime}.
  463. * Note: In this case, "autumn" refers to the northern hemisphere's seasons.
  464. * @internal
  465. */
  466. // static double AUTUMN_EQUINOX();
  467. /**
  468. * Constant representing the winter solstice.
  469. * For use with {@link #getSunTime getSunTime}.
  470. * Note: In this case, "winter" refers to the northern hemisphere's seasons.
  471. * @internal
  472. */
  473. static double WINTER_SOLSTICE();
  474. /**
  475. * Find the next time at which the sun's ecliptic longitude will have
  476. * the desired value.
  477. * @internal
  478. */
  479. UDate getSunTime(double desired, UBool next);
  480. /**
  481. * Returns the time (GMT) of sunrise or sunset on the local date to which
  482. * this calendar is currently set.
  483. *
  484. * NOTE: This method only works well if this object is set to a
  485. * time near local noon. Because of variations between the local
  486. * official time zone and the geographic longitude, the
  487. * computation can flop over into an adjacent day if this object
  488. * is set to a time near local midnight.
  489. *
  490. * @internal
  491. */
  492. UDate getSunRiseSet(UBool rise);
  493. //-------------------------------------------------------------------------
  494. // The Moon
  495. //-------------------------------------------------------------------------
  496. /**
  497. * The position of the moon at the time set on this
  498. * object, in equatorial coordinates.
  499. * @internal
  500. * @return const reference to internal field of calendar astronomer. Do not use outside of the lifetime of this astronomer.
  501. */
  502. const Equatorial& getMoonPosition();
  503. /**
  504. * The "age" of the moon at the time specified in this object.
  505. * This is really the angle between the
  506. * current ecliptic longitudes of the sun and the moon,
  507. * measured in radians.
  508. *
  509. * @see #getMoonPhase
  510. * @internal
  511. */
  512. double getMoonAge();
  513. /**
  514. * Calculate the phase of the moon at the time set in this object.
  515. * The returned phase is a <code>double</code> in the range
  516. * <code>0 <= phase < 1</code>, interpreted as follows:
  517. * <ul>
  518. * <li>0.00: New moon
  519. * <li>0.25: First quarter
  520. * <li>0.50: Full moon
  521. * <li>0.75: Last quarter
  522. * </ul>
  523. *
  524. * @see #getMoonAge
  525. * @internal
  526. */
  527. double getMoonPhase();
  528. class U_I18N_API MoonAge : public UMemory {
  529. public:
  530. MoonAge(double l)
  531. : value(l) { }
  532. void set(double l) { value = l; }
  533. double value;
  534. };
  535. /**
  536. * Constant representing a new moon.
  537. * For use with {@link #getMoonTime getMoonTime}
  538. * @internal
  539. */
  540. static const MoonAge NEW_MOON();
  541. /**
  542. * Constant representing the moon's first quarter.
  543. * For use with {@link #getMoonTime getMoonTime}
  544. * @internal
  545. */
  546. // static const MoonAge FIRST_QUARTER();
  547. /**
  548. * Constant representing a full moon.
  549. * For use with {@link #getMoonTime getMoonTime}
  550. * @internal
  551. */
  552. static const MoonAge FULL_MOON();
  553. /**
  554. * Constant representing the moon's last quarter.
  555. * For use with {@link #getMoonTime getMoonTime}
  556. * @internal
  557. */
  558. // static const MoonAge LAST_QUARTER();
  559. /**
  560. * Find the next or previous time at which the Moon's ecliptic
  561. * longitude will have the desired value.
  562. * <p>
  563. * @param desired The desired longitude.
  564. * @param next <tt>true</tt> if the next occurrance of the phase
  565. * is desired, <tt>false</tt> for the previous occurrance.
  566. * @internal
  567. */
  568. UDate getMoonTime(double desired, UBool next);
  569. UDate getMoonTime(const MoonAge& desired, UBool next);
  570. /**
  571. * Returns the time (GMT) of sunrise or sunset on the local date to which
  572. * this calendar is currently set.
  573. * @internal
  574. */
  575. UDate getMoonRiseSet(UBool rise);
  576. //-------------------------------------------------------------------------
  577. // Interpolation methods for finding the time at which a given event occurs
  578. //-------------------------------------------------------------------------
  579. // private
  580. class AngleFunc : public UMemory {
  581. public:
  582. virtual double eval(CalendarAstronomer&) = 0;
  583. virtual ~AngleFunc();
  584. };
  585. friend class AngleFunc;
  586. UDate timeOfAngle(AngleFunc& func, double desired,
  587. double periodDays, double epsilon, UBool next);
  588. class CoordFunc : public UMemory {
  589. public:
  590. virtual void eval(Equatorial& result, CalendarAstronomer&) = 0;
  591. virtual ~CoordFunc();
  592. };
  593. friend class CoordFunc;
  594. double riseOrSet(CoordFunc& func, UBool rise,
  595. double diameter, double refraction,
  596. double epsilon);
  597. //-------------------------------------------------------------------------
  598. // Other utility methods
  599. //-------------------------------------------------------------------------
  600. private:
  601. /**
  602. * Return the obliquity of the ecliptic (the angle between the ecliptic
  603. * and the earth's equator) at the current time. This varies due to
  604. * the precession of the earth's axis.
  605. *
  606. * @return the obliquity of the ecliptic relative to the equator,
  607. * measured in radians.
  608. */
  609. double eclipticObliquity();
  610. //-------------------------------------------------------------------------
  611. // Private data
  612. //-------------------------------------------------------------------------
  613. private:
  614. /**
  615. * Current time in milliseconds since 1/1/1970 AD
  616. * @see java.util.Date#getTime
  617. */
  618. UDate fTime;
  619. /* These aren't used yet, but they'll be needed for sunset calculations
  620. * and equatorial to horizon coordinate conversions
  621. */
  622. double fLongitude;
  623. double fLatitude;
  624. double fGmtOffset;
  625. //
  626. // The following fields are used to cache calculated results for improved
  627. // performance. These values all depend on the current time setting
  628. // of this object, so the clearCache method is provided.
  629. //
  630. double julianDay;
  631. double julianCentury;
  632. double sunLongitude;
  633. double meanAnomalySun;
  634. double moonLongitude;
  635. double moonEclipLong;
  636. double meanAnomalyMoon;
  637. double eclipObliquity;
  638. double siderealT0;
  639. double siderealTime;
  640. void clearCache();
  641. Equatorial moonPosition;
  642. UBool moonPositionSet;
  643. /**
  644. * @internal
  645. */
  646. // UDate local(UDate localMillis);
  647. };
  648. U_NAMESPACE_END
  649. struct UHashtable;
  650. U_NAMESPACE_BEGIN
  651. /**
  652. * Cache of month -> julian day
  653. * @internal
  654. */
  655. class CalendarCache : public UMemory {
  656. public:
  657. static int32_t get(CalendarCache** cache, int32_t key, UErrorCode &status);
  658. static void put(CalendarCache** cache, int32_t key, int32_t value, UErrorCode &status);
  659. virtual ~CalendarCache();
  660. private:
  661. CalendarCache(int32_t size, UErrorCode& status);
  662. static void createCache(CalendarCache** cache, UErrorCode& status);
  663. /**
  664. * not implemented
  665. */
  666. CalendarCache();
  667. UHashtable *fTable;
  668. };
  669. U_NAMESPACE_END
  670. #endif
  671. #endif