/**
  * The constructor taking an integer Julian day number assumes that the desired {@link
  * YearMonthDay} should represent the Gregorian day corresponding to the beginning of the provided
  * Julian day number. If the {@link JulianDate} is more than one half day later than that, the
  * calculation will be wrong.
  *
  * <p>So, if {@code date} is more than 12 hours past the start of the Julian day, we instead use
  * the Julian date number of tomorrow.
  *
  * @param date The date.
  * @return The Julian day number that will produce the correct Gregorian day number.
  */
 private static int getAdjustedJulianDayNumber(JulianDate date) {
   int day = date.getDay();
   if (date.getSecondsOfDay() >= 43200.0) {
     ++day;
   }
   return day;
 }
 @Test
 @Ignore
 public final void sandbox() {
   JulianDate date = new JulianDate(2451545.0);
   {
     StringWriter sw = new StringWriter();
     try {
       CesiumOutputStream output = new CesiumOutputStream(sw);
       output.setPrettyFormatting(true);
       CesiumStreamWriter writer = new CesiumStreamWriter();
       {
         PacketCesiumWriter packet = writer.openPacket(output);
         try {
           packet.writeId("MyID");
           packet.writeAvailability(date, date.addDays(1.0));
           {
             PositionCesiumWriter position = packet.openPositionProperty();
             try {
               {
                 CesiumIntervalListWriter<cesiumlanguagewriter.PositionCesiumWriter> intervalList =
                     position.openMultipleIntervals();
                 try {
                   {
                     PositionCesiumWriter interval = intervalList.openInterval();
                     try {
                       interval.writeInterval(new TimeInterval(date, date.addDays(1.0)));
                       interval.writeCartesian(new Cartesian(1.0, 2.0, 3.0));
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                   {
                     PositionCesiumWriter interval =
                         intervalList.openInterval(date.addDays(1.0), date.addDays(2.0));
                     try {
                       ArrayList<cesiumlanguagewriter.JulianDate> dates =
                           new ArrayList<cesiumlanguagewriter.JulianDate>();
                       ArrayList<cesiumlanguagewriter.Cartographic> positions =
                           new ArrayList<cesiumlanguagewriter.Cartographic>();
                       dates.add(date.addDays(1.0));
                       positions.add(Cartographic.getZero());
                       dates.add(date.addDays(1.5));
                       positions.add(new Cartographic(1.0, 0.0, 0.0));
                       dates.add(date.addDays(2.0));
                       positions.add(new Cartographic(0.0, 1.0, 0.0));
                       interval.writeCartographicRadians(dates, positions);
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                 } finally {
                   DisposeHelper.dispose(intervalList);
                 }
               }
             } finally {
               DisposeHelper.dispose(position);
             }
           }
           {
             OrientationCesiumWriter orientation = packet.openOrientationProperty();
             try {
               {
                 CesiumIntervalListWriter<cesiumlanguagewriter.OrientationCesiumWriter>
                     intervalList = orientation.openMultipleIntervals();
                 try {
                   {
                     OrientationCesiumWriter interval = intervalList.openInterval();
                     try {
                       interval.writeAxes("MyMadeUpAxes");
                       interval.writeInterval(new TimeInterval(date, date.addDays(1.0)));
                       interval.writeUnitQuaternion(new UnitQuaternion(1D, 0D, 0D, 0D));
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                   {
                     OrientationCesiumWriter interval = intervalList.openInterval();
                     try {
                       interval.writeInterpolationAlgorithm(CesiumInterpolationAlgorithm.LINEAR);
                       interval.writeInterpolationDegree(1);
                       ArrayList<cesiumlanguagewriter.JulianDate> dates =
                           new ArrayList<cesiumlanguagewriter.JulianDate>();
                       ArrayList<cesiumlanguagewriter.UnitQuaternion> orientations =
                           new ArrayList<cesiumlanguagewriter.UnitQuaternion>();
                       dates.add(date.addDays(1.0));
                       orientations.add(UnitQuaternion.getIdentity());
                       dates.add(date.addDays(1.5));
                       orientations.add(new UnitQuaternion(0.0, 1.0, 0.0, 0.0));
                       dates.add(date.addDays(2.0));
                       orientations.add(new UnitQuaternion(0.0, 0.0, 1.0, 0.0));
                       interval.writeUnitQuaternion(dates, orientations);
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                 } finally {
                   DisposeHelper.dispose(intervalList);
                 }
               }
             } finally {
               DisposeHelper.dispose(orientation);
             }
           }
         } finally {
           DisposeHelper.dispose(packet);
         }
       }
       ConsoleHelper.writeLine(sw.toString());
     } finally {
       DisposeHelper.dispose(sw);
     }
   }
 }