From a2983e36c9603ddb43f7016f16e445e1b26bd885 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 17 Apr 2012 23:00:26 +0200 Subject: [PATCH] Turn Base into abstract base class, extract Base interface. --- .../demoscenemusic/data/AbstractBase.java | 37 ++++++++++++++++++++++ .../demoscenemusic/data/AbstractTrack.java | 2 +- .../pterodactylus/demoscenemusic/data/Artist.java | 2 +- .../pterodactylus/demoscenemusic/data/Base.java | 13 ++------ .../pterodactylus/demoscenemusic/data/Group.java | 2 +- .../pterodactylus/demoscenemusic/data/Party.java | 2 +- .../pterodactylus/demoscenemusic/data/Track.java | 5 ++- 7 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 src/main/java/net/pterodactylus/demoscenemusic/data/AbstractBase.java diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/AbstractBase.java b/src/main/java/net/pterodactylus/demoscenemusic/data/AbstractBase.java new file mode 100644 index 0000000..2f7f3c7 --- /dev/null +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/AbstractBase.java @@ -0,0 +1,37 @@ +/* + * DemosceneMusic - Base.java - Copyright © 2012 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.demoscenemusic.data; + +/** + * TODO + * + * @author David ‘Bombe’ Roden + */ +public class AbstractBase { + + private final String id; + + protected AbstractBase(String id) { + this.id = id; + } + + public String id() { + return id; + } + +} diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/AbstractTrack.java b/src/main/java/net/pterodactylus/demoscenemusic/data/AbstractTrack.java index 77e625f..78dd4d2 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/AbstractTrack.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/AbstractTrack.java @@ -22,7 +22,7 @@ package net.pterodactylus.demoscenemusic.data; * * @author David ‘Bombe’ Roden */ -public abstract class AbstractTrack extends Base implements Track { +public abstract class AbstractTrack extends AbstractBase implements Track { private String name; diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/Artist.java b/src/main/java/net/pterodactylus/demoscenemusic/data/Artist.java index 8a0a5a4..3b26155 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/Artist.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/Artist.java @@ -22,7 +22,7 @@ package net.pterodactylus.demoscenemusic.data; * * @author David ‘Bombe’ Roden */ -public class Artist extends Base { +public class Artist extends AbstractBase { private String name; diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/Base.java b/src/main/java/net/pterodactylus/demoscenemusic/data/Base.java index 9ac65ad..7a36493 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/Base.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/Base.java @@ -17,21 +17,14 @@ package net.pterodactylus.demoscenemusic.data; + /** * TODO * * @author David ‘Bombe’ Roden */ -public class Base { - - private final String id; - - protected Base(String id) { - this.id = id; - } +public interface Base { - public String id() { - return id; - } + public String id(); } diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/Group.java b/src/main/java/net/pterodactylus/demoscenemusic/data/Group.java index d5b6972..dda449c 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/Group.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/Group.java @@ -22,7 +22,7 @@ package net.pterodactylus.demoscenemusic.data; * * @author David ‘Bombe’ Roden */ -public class Group extends Base { +public class Group extends AbstractBase { private String name; private String url; diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/Party.java b/src/main/java/net/pterodactylus/demoscenemusic/data/Party.java index 1bb1686..dbf1b8e 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/Party.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/Party.java @@ -22,7 +22,7 @@ package net.pterodactylus.demoscenemusic.data; * * @author David ‘Bombe’ Roden */ -public class Party extends Base { +public class Party extends AbstractBase { private String name; diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/Track.java b/src/main/java/net/pterodactylus/demoscenemusic/data/Track.java index 4511ae1..695cafe 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/Track.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/Track.java @@ -17,16 +17,15 @@ package net.pterodactylus.demoscenemusic.data; - /** * TODO * * @author David ‘Bombe’ Roden */ -public interface Track { +public interface Track extends Base { - public String id(); public String name(); + public Artist artist(); } -- 2.7.4