
net.time4j.tz.other.MilitaryZone Maven / Gradle / Ivy
/*
* -----------------------------------------------------------------------
* Copyright © 2013-2015 Meno Hochschild,
* -----------------------------------------------------------------------
* This file (MilitaryZone.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 .
* -----------------------------------------------------------------------
*/
package net.time4j.tz.other;
import net.time4j.tz.TZID;
import net.time4j.tz.ZonalOffset;
/**
* Represents a military timezone (used by US) where the globe is divided
* into fixed offset zones using the NATO phonetic alphabet.
*
* @author Meno Hochschild
* @since 2.2
*/
/*[deutsch]
* Repräsentiert eine militärische Zeitzone (verwendet vom
* US-Militär), wo der Globus in Zonen mit festem Offset eingeteilt
* ist, unter Verwendung des phonetischen Alphabets der NATO.
*
* @author Meno Hochschild
* @since 2.2
*/
public enum MilitaryZone
implements TZID {
//~ Statische Felder/Initialisierungen --------------------------------
/**
* Offset UTC+01:00
*/
ALPHA(1, "Alpha"),
/**
* Offset UTC+02:00
*/
BRAVO(2, "Bravo"),
/**
* Offset UTC+03:00
*/
CHARLIE(3, "Charlie"),
/**
* Offset UTC+04:00
*/
DELTA(4, "Delta"),
/**
* Offset UTC+05:00
*/
ECHO(5, "Echo"),
/**
* Offset UTC+06:00
*/
FOXTROT(6, "Foxtrot"),
/**
* Offset UTC+07:00
*/
GOLF(7, "Golf"),
/**
* Offset UTC+08:00
*/
HOTEL(8, "Hotel"),
/**
* Offset UTC+09:00
*/
INDIA(9, "India"),
/**
* Offset UTC+10:00
*/
KILO(10, "Kilo"),
/**
* Offset UTC+11:00
*/
LIMA(11, "Lima"),
/**
* Offset UTC+12:00
*/
MIKE(12, "Mike"),
/**
* Offset UTC-01:00
*/
NOVEMBER(-1, "November"),
/**
* Offset UTC-02:00
*/
OSCAR(-2, "Oscar"),
/**
* Offset UTC-03:00
*/
PAPA(-3, "Papa"),
/**
* Offset UTC-04:00
*/
QUEBEC(-4, "Quebec"),
/**
* Offset UTC-05:00
*/
ROMEO(-5, "Romeo"),
/**
* Offset UTC-06:00
*/
SIERRA(-6, "Sierra"),
/**
* Offset UTC-07:00
*/
TANGO(-7, "Tango"),
/**
* Offset UTC-08:00
*/
UNIFORM(-8, "Uniform"),
/**
* Offset UTC-09:00
*/
VICTOR(-9, "Victor"),
/**
* Offset UTC-10:00
*/
WHISKEY(-10, "Whiskey"),
/**
* Offset UTC-11:00
*/
X_RAY(-11, "X-ray"),
/**
* Offset UTC-12:00
*/
YANKEE(-12, "Yankee"),
/**
* Equivalent to {@code ZonalOffset.UTC}.
*/
/*[deutsch]
* Äquivalent zu {@code ZonalOffset.UTC}.
*/
ZULU(0, "Zulu");
//~ Instanzvariablen --------------------------------------------------
private transient final ZonalOffset offset;
private transient final String full;
//~ Konstruktoren -----------------------------------------------------
private MilitaryZone(
int offsetInHours,
String full
){
this.offset = ZonalOffset.ofTotalSeconds(offsetInHours * 3600);
this.full = full;
}
//~ Methoden ----------------------------------------------------------
/**
* Yields the associated timezone offset.
*
* @return ZonalOffset in full hours
* @since 2.2
*/
/*[deutsch]
* Liefert den assoziierten Zeitzonenversatz.
*
* @return ZonalOffset in full hours
* @since 2.2
*/
public ZonalOffset getOffset() {
return this.offset;
}
/**
* Yields the first letter of the full name (for example
* "A").
*
* @return String
* @since 2.2
*/
/*[deutsch]
* Liefert den ersten Buchstaben des vollen Namens (zum Beispiel
* "A").
*
* @return String
* @since 2.2
*/
public String getSymbol() {
return this.full.substring(0, 1);
}
/**
* Yields the full name (for example "Alpha").
*
* @return String
*/
/*[deutsch]
* Liefert den vollen Namen (zum Beispiel "Alpha").
*
* @return String
*/
@Override
public String toString() {
return this.full;
}
/**
* Yields a canonical form of this timezone identifier, for
* example "MILITARY~UTC+01:00".
*
* @return String in format "MILITARY~{offset}"
*/
/*[deutsch]
* Liefert eine kanonische Form dieser Zeitzonen-ID, zum Beispiel
* "MILITARY~UTC+01:00".
*
* @return String in format "MILITARY~{offset}"
*/
@Override
public String canonical() {
return "MILITARY~" + this.offset.canonical();
}
}