Skip to content

Commit 20ad65d

Browse files
committed
remove warning
1 parent 8aa8f48 commit 20ad65d

2 files changed

Lines changed: 42 additions & 87 deletions

File tree

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
* MediathekView
33
* Copyright (C) 2008 W. Xaver
44
* W.Xaver[at]googlemail.com
55
* http://zdfmediathk.sourceforge.net/
6-
*
6+
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by
99
* the Free Software Foundation, either version 3 of the License, or
@@ -24,50 +24,22 @@
2424

2525
@SuppressWarnings("serial")
2626
public class Datum extends Date {
27-
private final static SimpleDateFormat dateFormatter1 = new SimpleDateFormat("dd.MM.yyyy");
28-
private final static SimpleDateFormat dateFormatter2 = new SimpleDateFormat("yyyy.MM.dd");
29-
30-
public Datum() {
31-
super();
32-
}
33-
34-
public Datum(long l) {
35-
super(l);
36-
}
37-
38-
@Override
39-
public String toString() {
40-
if (this.getTime() == 0) {
41-
return "";
42-
} else {
43-
return dateFormatter1.format(this);
44-
}
45-
}
46-
47-
public String toStringR() {
48-
if (this.getTime() == 0) {
49-
return dateFormatter2.format(new Date());
50-
} else {
51-
return dateFormatter2.format(this);
52-
}
53-
}
54-
55-
/**
56-
* Liefert den Betrag der Zeitdifferenz zu jetzt.
57-
*
58-
* @return Differenz in Sekunden.
59-
*/
60-
public int diffInSekunden() {
61-
final int ret = new Long((this.getTime() - new Datum().getTime()) / (1000)).intValue();
62-
return Math.abs(ret);
63-
}
64-
65-
/**
66-
* Liefert den BETRAG! der Zeitdifferenz zu jetzt.
67-
*
68-
* @return Differenz in Minuten.
69-
*/
70-
public int diffInMinuten() {
71-
return (diffInSekunden() / 60);
27+
private static final SimpleDateFormat dateFormatter1 = new SimpleDateFormat("dd.MM.yyyy");
28+
29+
public Datum() {
30+
super();
31+
}
32+
33+
public Datum(long l) {
34+
super(l);
35+
}
36+
37+
@Override
38+
public String toString() {
39+
if (this.getTime() == 0) {
40+
return "";
41+
} else {
42+
return dateFormatter1.format(this);
7243
}
44+
}
7345
}
Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
* MediathekView
33
* Copyright (C) 2008 W. Xaver
44
* W.Xaver[at]googlemail.com
55
* http://zdfmediathk.sourceforge.net/
6-
*
6+
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by
99
* the Free Software Foundation, either version 3 of the License, or
@@ -19,56 +19,39 @@
1919
*/
2020
package de.mediathekview.mlib.tool;
2121

22-
import de.mediathekview.mlib.tool.Datum;
23-
2422
import java.text.SimpleDateFormat;
25-
import java.util.Date;
2623
import java.util.TimeZone;
2724

2825
@SuppressWarnings("serial")
2926
public class DatumFilm extends Datum {
30-
// die Filme werden immer in der Zeitzone "Europe/Berlin" gesucht
27+
// die Filme werden immer in der Zeitzone "Europe/Berlin" gesucht
3128

32-
private final static SDF dateFormatter1 = new SDF("dd.MM.yyyy");
33-
private final static SDF dateFormatter2 = new SDF("yyyy.MM.dd");
29+
private static final SDF dateFormatter1 = new SDF("dd.MM.yyyy");
3430

35-
public DatumFilm() {
36-
super();
37-
}
31+
public DatumFilm(long l) {
32+
super(l);
33+
}
3834

39-
public DatumFilm(long l) {
40-
super(l);
35+
@Override
36+
public String toString() {
37+
if (this.getTime() == 0) {
38+
return "";
39+
} else {
40+
return dateFormatter1.format(this);
4141
}
42+
}
4243

43-
@Override
44-
public String toString() {
45-
if (this.getTime() == 0) {
46-
return "";
47-
} else {
48-
return dateFormatter1.format(this);
49-
}
50-
}
44+
private static class SDF extends SimpleDateFormat {
45+
private static final TimeZone tz = TimeZone.getTimeZone("Europe/Berlin");
5146

52-
@Override
53-
public String toStringR() {
54-
if (this.getTime() == 0) {
55-
return dateFormatter2.format(new Date());
56-
} else {
57-
return dateFormatter2.format(this);
58-
}
47+
public SDF() {
48+
super();
49+
this.setTimeZone(tz);
5950
}
6051

61-
private static class SDF extends SimpleDateFormat {
62-
private final static TimeZone tz = TimeZone.getTimeZone("Europe/Berlin");
63-
64-
public SDF() {
65-
super();
66-
this.setTimeZone(tz);
67-
}
68-
69-
public SDF(String str) {
70-
super(str);
71-
this.setTimeZone(tz);
72-
}
52+
public SDF(String str) {
53+
super(str);
54+
this.setTimeZone(tz);
7355
}
56+
}
7457
}

0 commit comments

Comments
 (0)