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

net.time4j.engine.Temporal Maven / Gradle / Ivy

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


import java.util.stream.Stream;

/**
 * 

Represents an object which can be sorted on a time axis in a * temporal-only way.

* * @param generic temporal type for pure temporal comparison purposes * @author Meno Hochschild */ /*[deutsch] *

Repräsentiert ein Objekt, das auf einem Zeitstrahl rein zeitlich * angeordnet werden kann.

* * @param generic temporal type for pure temporal comparison purposes * @author Meno Hochschild */ public interface Temporal { //~ Methoden ---------------------------------------------------------- /** *

Queries if this object is after given object on a timeline.

* * @param temporal object this instance is compared to * @return {@code true} if this instance is temporally after * {@code temporal} else {@code false} */ /*[deutsch] *

Liegt dieses Objekt zeitlich nach dem angegebenen Argument?

* * @param temporal object this instance is compared to * @return {@code true} if this instance is temporally after * {@code temporal} else {@code false} */ boolean isAfter(C temporal); /** *

Queries if this object is before given object on a timeline.

* * @param temporal object this instance is compared to * @return {@code true} if this instance is temporally before * {@code temporal} else {@code false} */ /*[deutsch] *

Liegt dieses Objekt zeitlich vor dem angegebenen Argument?

* * @param temporal object this instance is compared to * @return {@code true} if this instance is temporally before * {@code temporal} else {@code false} */ boolean isBefore(C temporal); /** *

Queries if this object and given object have the same position * on the time axis.

* *

Is equivalent to {@code !isAfter(temporal) && !isBefore(temporal)}. * This method differs from the {@code Object}-method {@code equals()} * such that first the comparison type must be a temporal one and second * that only temporal-only state will be considered.

* * @param temporal object this instance is compared to * @return {@code true} if this instance is temporally equal * to {@code temporal} else {@code false} */ /*[deutsch] *

Sind dieses Objekt und das angegebene Argument zeitlich gleich?

* *

Entspricht {@code !isAfter(temporal) && !isBefore(temporal)}. Diese * Methode unterscheidet sich von der Objektmethode {@code equals()} darin, * daß erstens der Vergleichstyp ein temporaler sein muß und * zweitens nur rein zeitliche Zustandsattribute verglichen werden.

* * @param temporal object this instance is compared to * @return {@code true} if this instance is temporally equal * to {@code temporal} else {@code false} */ boolean isSimultaneous(C temporal); /** *

Queries if this object is after all given objects on a timeline.

* * @param temporals array of objects this instance is compared to * @return {@code true} if this instance is temporally after every object * in {@code temporals} else {@code false} */ /*[deutsch] *

Liegt dieses Objekt zeitlich nach allen angegebenen Argumenten?

* * @param temporals array of objects this instance is compared to * @return {@code true} if this instance is temporally after every object * in {@code temporals} else {@code false} */ default boolean isAfterAll(C... temporals) { return Stream.of(temporals).allMatch(this::isAfter); } /** *

Queries if this object is before all given objects on a timeline.

* * @param temporals array of objects this instance is compared to * @return {@code true} if this instance is temporally before every object * in {@code temporals} else {@code false} */ /*[deutsch] *

Liegt dieses Objekt zeitlich vor allen angegebenen Argumenten?

* * @param temporals array of objects this instance is compared to * @return {@code true} if this instance is temporally before every object * in {@code temporals} else {@code false} */ default boolean isBeforeAll(C... temporals) { return Stream.of(temporals).allMatch(this::isBefore); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy