/* * ----------------------------------------------------------------------- * Copyright © 2013-2016 Meno Hochschild, <http://www.menodata.de/> * ----------------------------------------------------------------------- * This file (Leniency.java) is part of project Time4J. * * Time4J is free software: You can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 2.1 of the License, or * (at your option) any later version. * * Time4J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Time4J. If not, see <http://www.gnu.org/licenses/>. * ----------------------------------------------------------------------- */ package net.time4j.format; /** * <p>Defines how lenient parsing of chronological texts should be. </p> * * @author Meno Hochschild */ /*[deutsch] * <p>Nachsichtigkeitsmodus beim Parsen von Text zu chronologischen Typen. </p> * * @author Meno Hochschild */ public enum Leniency { //~ Statische Felder/Initialisierungen -------------------------------- /** * <p>Ensures that all range limits and other validity constraints will * be strictly controlled. </p> * * <p>Exceeding the possibly context-dependent range of an element value * will always throw an exception. </p> * * <p>A consistency check will be performed, too. That means all * parsed informations must be consistent (for example the right * weekday for a given calendar date). In parsing, the given limits * for minimum and maximum count of chars to be interpreted will * be checked, too. </p> */ /*[deutsch] * <p>Stellt das strikte Einhalten von Wertbereichsgrenzen und anderen * Gültigkeitseinschränkungen sicher. </p> * * <p>Wertbereichsüberschreitungen werden immer mit einer Ausnahme * quittiert. </p> * * <p>Auch findet eine Konsistenzprüfung statt, die prüft, * daß alle gegebenen Informationen zueinander passen müssen * (z.B. der richtige Wochentag passend zu einem Datum). Beim Parsen werden * nur hier die angegebenen Grenzen für die minimale und die maximale * Anzahl von zu interpretierenden Zeichen genau geprüft. </p> */ STRICT, /** * <p>This default mode tries to be a compromise between a pedantic * and a lax strategy by paying attention to value range constraints * but neglecting some constraints like the width of numerical * elements. </p> * * <p>There is no consistency check like in strict mode. For example * a wrong weekday will be ignored and the calendar date will just * be interpreted on the base of year, month and day of month. </p> */ /*[deutsch] * <p>Mit dieser Standardvorgabe wird versucht, einen Mittelweg zwischen * einer pedantischen und laxen Strategie zu wählen, indem zwar auf * Wertbereichsüberschreitungen geachtet wird, aber bestimmte * Einstellungen wie die Breite von numerischen Elementen tolerant * gehandhabt werden. </p> * * <p>Eine Konsistenzprüfung wie im strikten Modus findet nicht * statt. So wird ein falscher Wochentag ignoriert und das Datum eher * auf Basis von Jahr, Monat und Tag des Monats interpretiert. </p> */ SMART, /** * <p>The parsed data will be interpreted without any consistency * check or validation of range limits. </p> * * <p>This mode even tolerates values like the wall time "T25:00" * or the invalid calendar date "2014-02-31" which will be * interpreted with the suitable day overflow as "2014-03-03". </p> */ /*[deutsch] * <p>Die Daten werden beim ersten passenden Treffer ohne weitere * Konsistenzprüfung interpretiert. </p> * * <p>Auch aus dem definierten Wertbereich fallende Werte wie die * Uhrzeit "T25:00:00" oder das Datum "2014-02-31" * werden akzeptiert und mit Überlauf uminterpretiert. </p> */ LAX; //~ Methoden ---------------------------------------------------------- /** * <p>Is this leniency mode strict? </p> * * @return boolean */ /*[deutsch] * <p>Ist dieser Nachsichtigkeitsmodus strikt? </p> * * @return boolean */ public boolean isStrict() { return (this == STRICT); } /** * <p>Is this leniency mode <i>smart</i>? </p> * * @return boolean */ /*[deutsch] * <p>Ist dieser Nachsichtigkeitsmodus <i>smart</i>? </p> * * @return boolean */ public boolean isSmart() { return (this == SMART); } /** * <p>Is this leniency mode lax? </p> * * @return boolean */ /*[deutsch] * <p>Ist dieser Nachsichtigkeitsmodus lax? </p> * * @return boolean */ public boolean isLax() { return (this == LAX); } }