All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.time4j.TimeElement Maven / Gradle / Ivy

There is a newer version: 4.38
Show newest version
/*
 * -----------------------------------------------------------------------
 * Copyright © 2013-2014 Meno Hochschild, 
 * -----------------------------------------------------------------------
 * This file (TimeElement.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;

import net.time4j.engine.BasicElement;
import net.time4j.engine.ChronoDisplay;
import net.time4j.engine.ChronoFunction;
import net.time4j.tz.TZID;
import net.time4j.tz.Timezone;
import net.time4j.tz.ZonalOffset;

import java.io.ObjectStreamException;


/**
 * 

Repräsentiert eine Uhrzeitkomponente.

* * @author Meno Hochschild * @concurrency */ final class TimeElement extends BasicElement implements WallTimeElement { //~ Statische Felder/Initialisierungen -------------------------------- /** * Singleton-Instanz. */ static final TimeElement INSTANCE = new TimeElement(); private static final long serialVersionUID = -3712256393866098916L; //~ Konstruktoren ----------------------------------------------------- private TimeElement() { super("WALL_TIME"); } //~ Methoden ---------------------------------------------------------- @Override public Class getType() { return PlainTime.class; } @Override public PlainTime getDefaultMinimum() { return PlainTime.MIN; } @Override public PlainTime getDefaultMaximum() { return PlainTime.of(23, 59, 59, 999999999); } @Override public int compare( ChronoDisplay o1, ChronoDisplay o2 ) { return o1.get(this).compareTo(o2.get(this)); } @Override public boolean isDateElement() { return false; } @Override public boolean isTimeElement() { return true; } @Override public ElementOperator setToNext(PlainTime v) { return new WallTimeOperator(ElementOperator.OP_NAV_NEXT, v); } @Override public ElementOperator setToPrevious(PlainTime v) { return new WallTimeOperator(ElementOperator.OP_NAV_PREVIOUS, v); } @Override public ElementOperator setToNextOrSame(PlainTime v) { return new WallTimeOperator(ElementOperator.OP_NAV_NEXT_OR_SAME, v); } @Override public ElementOperator setToPreviousOrSame(PlainTime v) { return new WallTimeOperator( ElementOperator.OP_NAV_PREVIOUS_OR_SAME, v); } @Override public ElementOperator roundedToFullHour() { return FullValueOperator.ROUNDING_FULL_HOUR; } @Override public ElementOperator roundedToFullMinute() { return FullValueOperator.ROUNDING_FULL_MINUTE; } @Override public ElementOperator setToNextFullHour() { return FullValueOperator.NEXT_FULL_HOUR; } @Override public ElementOperator setToNextFullMinute() { return FullValueOperator.NEXT_FULL_MINUTE; } @Override public ChronoFunction inStdTimezone() { return this.in(Timezone.ofSystem()); } @Override public ChronoFunction inTimezone(TZID tzid) { return this.in(Timezone.of(tzid)); } @Override public ChronoFunction in(Timezone tz) { return new ZonalQuery(this, tz); } @Override public ChronoFunction atUTC() { return this.at(ZonalOffset.UTC); } @Override public ChronoFunction at(ZonalOffset offset) { return new ZonalQuery(this, offset); } private Object readResolve() throws ObjectStreamException { return INSTANCE; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy