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

net.time4j.AbstractDateElement Maven / Gradle / Ivy

There is a newer version: 4.38
Show newest version
/*
 * -----------------------------------------------------------------------
 * Copyright © 2013-2016 Meno Hochschild, 
 * -----------------------------------------------------------------------
 * This file (AbstractDateElement.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.ChronoFunction;
import net.time4j.format.DisplayElement;
import net.time4j.tz.TZID;
import net.time4j.tz.Timezone;
import net.time4j.tz.ZonalOffset;


/**
 * 

Abstrakte Basisklasse für Datumselemente, die bereits alle * Methoden des Interface {@code AdjustableElement} vordefiniert.

* * @param generic type of element values * @author Meno Hochschild */ abstract class AbstractDateElement> extends DisplayElement implements AdjustableElement { //~ Instanzvariablen -------------------------------------------------- private transient final ElementOperator minimizer; private transient final ElementOperator maximizer; //~ Konstruktoren ----------------------------------------------------- AbstractDateElement(String name) { super(name); this.minimizer = new DateOperator(this, ElementOperator.OP_MINIMIZE); this.maximizer = new DateOperator(this, ElementOperator.OP_MAXIMIZE); } //~ Methoden ---------------------------------------------------------- @Override public ElementOperator newValue(V value) { return new DateOperator(this, ElementOperator.OP_NEW_VALUE, value); } @Override public ElementOperator minimized() { return this.minimizer; } @Override public ElementOperator maximized() { return this.maximizer; } @Override public ElementOperator decremented() { return new DateOperator(this, ElementOperator.OP_DECREMENT); } @Override public ElementOperator incremented() { return new DateOperator(this, ElementOperator.OP_INCREMENT); } @Override public ElementOperator atFloor() { return new DateOperator(this, ElementOperator.OP_FLOOR); } @Override public ElementOperator atCeiling() { return new DateOperator(this, ElementOperator.OP_CEILING); } public ElementOperator setLenient(V value) { return new DateOperator(this, ElementOperator.OP_LENIENT, value); } @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); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy