elements = parser.getElements().toArray(new TDateFormatElement[0]);
}
@Override
public TDate parse(String string, TParsePosition position) {
TCalendar calendar = new TGregorianCalendar(locale);
calendar.clear();
for (TDateFormatElement element : elements) {
if (position.getIndex() > string.length()) {
position.setErrorIndex(position.getErrorIndex());
return null;
}
element.parse(string, calendar, position);
if (position.getErrorIndex() >= 0) {
return null;
}
}
return calendar.getTime();
}