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

net.digitalid.utility.time.TimeSubclass Maven / Gradle / Ivy

The newest version!
package net.digitalid.utility.time;

import java.text.DateFormat;
import java.util.Objects;

import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import net.digitalid.utility.annotations.method.Pure;
import net.digitalid.utility.contracts.Ensure;
import net.digitalid.utility.contracts.Require;

@SuppressWarnings("null")
@Generated(value = "net.digitalid.utility.processor.generator.JavaFileGenerator", date = "2017-03-26T11:55:04.182+0200")
class TimeSubclass extends Time {
    
    /* -------------------------------------------------- Value -------------------------------------------------- */
    
    private final long value;
    
    @Override
    public long getValue() {
        long result = this.value;
        return result;
    }
    
    /* -------------------------------------------------- Constructors -------------------------------------------------- */
    
    TimeSubclass(long value) throws RuntimeException {
        super();
        
        this.value = value;
        initialize();
        validate();
    }
    
    /* -------------------------------------------------- Overridden Methods -------------------------------------------------- */
    
    @Override
    public  T castTo(Class targetClass) {
        T result = super.castTo(targetClass);
        Ensure.that(result == this).orThrow("The result has to be  but was $.", result);
        return result;
    }
    
    @Override
    public boolean isEqualTo(Time object) {
        boolean result = super.isEqualTo(object);
        return result;
    }
    
    @Override
    public boolean isGreaterThan(Time object) {
        boolean result = super.isGreaterThan(object);
        return result;
    }
    
    @Override
    public boolean isGreaterThanOrEqualTo(Time object) {
        boolean result = super.isGreaterThanOrEqualTo(object);
        return result;
    }
    
    @Override
    public boolean isLessThan(Time object) {
        boolean result = super.isLessThan(object);
        return result;
    }
    
    @Override
    public boolean isLessThanOrEqualTo(Time object) {
        boolean result = super.isLessThanOrEqualTo(object);
        return result;
    }
    
    @Override
    protected void initialize() throws RuntimeException {
        super.initialize();
    }
    
    @Override
    public boolean isNegative() {
        boolean result = super.isNegative();
        return result;
    }
    
    @Override
    public boolean isNonNegative() {
        boolean result = super.isNonNegative();
        return result;
    }
    
    @Override
    public boolean isPositive() {
        boolean result = super.isPositive();
        return result;
    }
    
    @Override
    public boolean isNonPositive() {
        boolean result = super.isNonPositive();
        return result;
    }
    
    @Override
    public @Nonnull Time add(@Nonnull Time time) {
        Require.that(time != null).orThrow("The time may not be null.", time);
        @Nonnull Time result = super.add(time);
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull Time subtract(@Nonnull Time time) {
        Require.that(time != null).orThrow("The time may not be null.", time);
        @Nonnull Time result = super.subtract(time);
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull Time multiply(int factor) {
        @Nonnull Time result = super.multiply(factor);
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull Time divide(int divisor) {
        @Nonnull Time result = super.divide(divisor);
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull Time round(@Nonnull Time interval) {
        Require.that(interval != null).orThrow("The interval may not be null.", interval);
        @Nonnull Time result = super.round(interval);
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull Time roundDown(@Nonnull Time interval) {
        Require.that(interval != null).orThrow("The interval may not be null.", interval);
        @Nonnull Time result = super.roundDown(interval);
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public boolean isMultipleOf(@Nonnull Time interval) {
        Require.that(interval != null).orThrow("The interval may not be null.", interval);
        boolean result = super.isMultipleOf(interval);
        return result;
    }
    
    @Override
    public @Nonnull Time ago() {
        @Nonnull Time result = super.ago();
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull Time ahead() {
        @Nonnull Time result = super.ahead();
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public boolean isInFuture() {
        boolean result = super.isInFuture();
        return result;
    }
    
    @Override
    public boolean isInPast() {
        boolean result = super.isInPast();
        return result;
    }
    
    @Override
    public long getYears() {
        long result = super.getYears();
        return result;
    }
    
    @Override
    public long getMonths() {
        long result = super.getMonths();
        return result;
    }
    
    @Override
    public long getWeeks() {
        long result = super.getWeeks();
        return result;
    }
    
    @Override
    public long getDays() {
        long result = super.getDays();
        return result;
    }
    
    @Override
    public long getHours() {
        long result = super.getHours();
        return result;
    }
    
    @Override
    public long getMinutes() {
        long result = super.getMinutes();
        return result;
    }
    
    @Override
    public long getSeconds() {
        long result = super.getSeconds();
        return result;
    }
    
    @Override
    public long getMilliseconds() {
        long result = super.getMilliseconds();
        return result;
    }
    
    @Override
    public @Nonnull String asDate(@Nonnull DateFormat formatter) {
        Require.that(formatter != null).orThrow("The formatter may not be null.", formatter);
        @Nonnull String result = super.asDate(formatter);
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull String asDate() {
        @Nonnull String result = super.asDate();
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    @Override
    public @Nonnull String asInterval() {
        @Nonnull String result = super.asInterval();
        Ensure.that(result != null).orThrow("The result may not be null.", result);
        return result;
    }
    
    /* -------------------------------------------------- Implement Methods -------------------------------------------------- */
    
    /* -------------------------------------------------- Generated Methods -------------------------------------------------- */
    
    /**
     * Returns false if the given object is not equal to the current object, using the heuristics that fields of a class, which are handed to the class via the recovery method or the constructor, must be equal to each other, so that the objects are considered equal.
     */
    @Pure
    @Override
    public boolean equals(@Nullable Object object) {
        if (object == this) {
            return true;
        }
        if (object == null || !(object instanceof Time)) {
            return false;
        }
        final @Nonnull Time that = (Time) object;
        boolean result = true;
        result = result && Objects.equals(this.getValue(), that.getValue());
        return result;
    }
    
    /**
     * Computes and returns the hash code of this object, using the fields of the class which are handed to the class via the recovery method or the constructor.
     */
    @Pure
    @Override
    public int hashCode() {
        int prime = 92_821;
        int result = 46_411;
        result = prime * result + Objects.hashCode(getValue());
        return result;
    }
    
    @Pure
    @Override
    public void validate() {
        super.validate();
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy