2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 import java.util.Calendar;
22 import java.util.Date;
23 import java.util.Locale;
24 import java.util.TimeZone;
27 * (incomplete) model class for java.text.SimpleDate. See Format for details
28 * about the native formatter delegation
30 public class SimpleDateFormat extends DateFormat {
32 // see DecimalFormat comments why we use explicit init0()'s
34 private native void init0();
35 private native void init0(String pattern);
36 private native void init0(int timeStyle, int dateStyle);
38 public SimpleDateFormat () {
43 public SimpleDateFormat (String pattern) {
45 throw new NullPointerException();
51 public SimpleDateFormat (String pattern, Locale locale) {
52 // <2do> bluntly ignoring locale for now
56 SimpleDateFormat (int timeStyle, int dateStyle, Locale locale){
57 init0(timeStyle, dateStyle);
61 // unfortunately we can't override the DateFormat.format(String) because
62 // it is final, and hence the compiler can do a INVOKE_SPECIAL
63 native String format0 (long dateTime);
66 public StringBuffer format (Date date, StringBuffer sb, FieldPosition pos) {
67 String s = format0(date.getTime());
70 // we don't do FieldPositions yet
77 public Date parse (String arg0, ParsePosition arg1) {
78 // TODO Auto-generated method stub
82 private void initializeCalendar() {
83 if (calendar == null) {
84 calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault());
88 native public void applyPattern(String pattern);