mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Fix some minor bugs (#745)
* Include other member variables in copy constructor * Add break to switch cases * Implement equals() in classes extending Comparable If equals() is not overridden, the equals() implementation is not consistent with the compareTo() implementation. If an object of such a class is added to a collection such as java.util.SortedSet, this collection will violate the contract of java.util.Set, which is defined in terms of equals(). Co-authored-by: Rob Ekl <xwq876@zebra.com>
This commit is contained in:
@@ -87,4 +87,10 @@ public class FleetsyncIdentifier extends TalkgroupIdentifier implements Comparab
|
||||
{
|
||||
return getValue().compareTo(o.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof FleetsyncIdentifier)) return false;
|
||||
return compareTo((FleetsyncIdentifier) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,4 +108,10 @@ public class LtrNetChannel implements IChannelDescriptor, Comparable<LtrNetChann
|
||||
{
|
||||
return Integer.compare(getChannel(), o.getChannel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof LtrNetChannel)) return false;
|
||||
return compareTo((LtrNetChannel) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,4 +63,10 @@ public class LtrNetRadioIdentifier extends TalkgroupIdentifier implements Compar
|
||||
{
|
||||
return getValue().compareTo(o.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof LtrNetRadioIdentifier)) return false;
|
||||
return compareTo((LtrNetRadioIdentifier) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,4 +102,10 @@ public class LtrChannel implements IChannelDescriptor, Comparable<LtrChannel>
|
||||
{
|
||||
return Integer.compare(getChannel(), o.getChannel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof LtrChannel)) return false;
|
||||
return compareTo((LtrChannel) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -706,6 +706,7 @@ public class MPT1327Message extends Message
|
||||
sb.append(getPresselOnRequired());
|
||||
sb.append(" IDENT1 VALUE:");
|
||||
sb.append(getMaintMessageIDENT1Value());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -86,4 +86,10 @@ public class P25ExplicitChannel extends P25Channel implements Comparable<P25Chan
|
||||
return Integer.compare(getDownlinkBandIdentifier(), other.getDownlinkBandIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof P25ExplicitChannel)) return false;
|
||||
return compareTo((P25ExplicitChannel) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,6 +646,7 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
|
||||
.details("ANSWER REQUEST")
|
||||
.identifiers(icUUAnswerRequest)
|
||||
.build());
|
||||
break;
|
||||
case OSP_CALL_ALERT:
|
||||
MutableIdentifierCollection icCallAlert = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
|
||||
icCallAlert.remove(IdentifierClass.USER);
|
||||
@@ -2122,6 +2123,7 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
|
||||
.identifiers(ic)
|
||||
.build());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// mLog.debug("Unrecognized TSBK Opcode: " + tsbk.getOpcode().name() + " VENDOR:" + tsbk.getVendor() +
|
||||
// " OPCODE:" + tsbk.getOpcodeNumber());
|
||||
|
||||
@@ -66,4 +66,10 @@ public class PassportTalkgroup extends TalkgroupIdentifier implements Comparable
|
||||
{
|
||||
return Integer.compare(getValue(), o.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof PassportTalkgroup)) return false;
|
||||
return compareTo((PassportTalkgroup) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user