Merge pull request #6346 from Imericxu/tabs-style-check

Resolve Tabs style checks
This commit is contained in:
Stypox 2021-06-08 14:49:14 +02:00 committed by GitHub
commit a2eead521f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 55 additions and 16 deletions

View File

@ -112,12 +112,16 @@ public abstract class Tab {
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (obj == this) { if (!(obj instanceof Tab)) {
return true; return false;
} }
final Tab other = (Tab) obj;
return getTabId() == other.getTabId();
}
return obj instanceof Tab && obj.getClass() == this.getClass() @Override
&& ((Tab) obj).getTabId() == this.getTabId(); public int hashCode() {
return Objects.hashCode(getTabId());
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -358,8 +362,18 @@ public abstract class Tab {
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
return super.equals(obj) && kioskServiceId == ((KioskTab) obj).kioskServiceId if (!(obj instanceof KioskTab)) {
&& Objects.equals(kioskId, ((KioskTab) obj).kioskId); return false;
}
final KioskTab other = (KioskTab) obj;
return super.equals(obj)
&& kioskServiceId == other.kioskServiceId
&& kioskId.equals(other.kioskId);
}
@Override
public int hashCode() {
return Objects.hash(getTabId(), kioskServiceId, kioskId);
} }
public int getKioskServiceId() { public int getKioskServiceId() {
@ -432,9 +446,19 @@ public abstract class Tab {
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
return super.equals(obj) && channelServiceId == ((ChannelTab) obj).channelServiceId if (!(obj instanceof ChannelTab)) {
&& Objects.equals(channelUrl, ((ChannelTab) obj).channelUrl) return false;
&& Objects.equals(channelName, ((ChannelTab) obj).channelName); }
final ChannelTab other = (ChannelTab) obj;
return super.equals(obj)
&& channelServiceId == other.channelServiceId
&& channelUrl.equals(other.channelName)
&& channelName.equals(other.channelName);
}
@Override
public int hashCode() {
return Objects.hash(getTabId(), channelServiceId, channelUrl, channelName);
} }
public int getChannelServiceId() { public int getChannelServiceId() {
@ -576,15 +600,30 @@ public abstract class Tab {
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (!(super.equals(obj) if (!(obj instanceof PlaylistTab)) {
&& Objects.equals(playlistType, ((PlaylistTab) obj).playlistType) return false;
&& Objects.equals(playlistName, ((PlaylistTab) obj).playlistName))) {
return false; // base objects are different
} }
return (playlistId == ((PlaylistTab) obj).playlistId) // local final PlaylistTab other = (PlaylistTab) obj;
|| (playlistServiceId == ((PlaylistTab) obj).playlistServiceId // remote
&& Objects.equals(playlistUrl, ((PlaylistTab) obj).playlistUrl)); return super.equals(obj)
&& playlistServiceId == other.playlistServiceId // Remote
&& playlistId == other.playlistId // Local
&& playlistUrl.equals(other.playlistUrl)
&& playlistName.equals(other.playlistName)
&& playlistType == other.playlistType;
}
@Override
public int hashCode() {
return Objects.hash(
getTabId(),
playlistServiceId,
playlistId,
playlistUrl,
playlistName,
playlistType
);
} }
public int getPlaylistServiceId() { public int getPlaylistServiceId() {