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