1 /* Contributed in the public domain.
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.utils;
18
19 import java.util.Locale;
20
21 /** Formatter used to produce strings from data.
22 * <p>
23 * Interface for formatters to be passed to generators, dictating how to write doubles and datetime.
24 * </p>
25 * @author John Ajamian
26 * @since 13.0
27 */
28 public interface Formatter {
29
30 /**
31 * Standardized locale to use, to ensure files can be exchanged without
32 * internationalization issues.
33 */
34 Locale STANDARDIZED_LOCALE = Locale.US;
35
36 /** String format used for dates. **/
37 String DATE_FORMAT = "%04d-%02d-%02dT%02d:%02d:%s";
38
39 /**
40 * Format a double number.
41 *
42 * @param value number to format
43 * @return number formatted.
44 */
45 String toString(double value);
46
47 /** Format a date. Does not check if date time is real or if it will meet formating requirements.
48 * @param year of date to be formatted
49 * @param month of date to be formatted
50 * @param day of month to be formatted
51 * @param hour to be formatted
52 * @param minute to be formatted
53 * @param seconds and sub-seconds to be formatted
54 * @return date formatted to match the following format [yyyy-MM-ddTHH:mm:ss.S#]
55 */
56 String toString(int year, int month, int day, int hour, int minute, double seconds);
57
58 }