view flys-aft/src/main/java/de/intevation/aft/TimeInterval.java @ 4421:0b0f415203f0

Add new Filter class to change caching Add new Filter class to avoid caching of GWT nocache files in browsers and http proxies. The new Filter class NoCacheFilter sets http headers to stop the proxies and browesers from storing the nocache files.
author Björn Ricks <bjoern.ricks@intevation.de>
date Tue, 06 Nov 2012 13:32:06 +0100
parents b6a18d706cbe
children b195fede1c3b
line wrap: on
line source
package de.intevation.aft;

import java.util.Date;

public class TimeInterval
implements   Comparable<TimeInterval>
{
    protected int  id;
    protected Date start;
    protected Date stop;

    public TimeInterval() {
    }

    public TimeInterval(Date start, Date stop) {
        this.start = start;
        this.stop  = stop;
    }

    public TimeInterval(int id, Date start, Date stop) {
        this(start, stop);
        this.id    = id;
    }

    protected static int compare(Date d1, Date d2) {
        long s1 = d1 != null ? d1.getTime()/1000L : 0L;
        long s2 = d2 != null ? d2.getTime()/1000L : 0L;
        long diff = s1 - s2;
        return diff < 0L 
            ? -1
            : diff > 0L ? 1 : 0;
    }

    @Override
    public int compareTo(TimeInterval other) {
        int cmp = compare(start, other.start);
        return cmp != 0 
            ? cmp
            : compare(stop, other.stop);
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getStart() {
        return start;
    }

    public void setStart(Date start) {
        this.start = start;
    }

    public Date getStop() {
        return stop;
    }

    public void setStop(Date stop) {
        this.stop = stop;
    }

    public String toString() {
        return "[TimeInterval: start=" + start + ", stop=" + stop + "]";
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org