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:
@@ -109,6 +109,7 @@ public class SourceManager
|
||||
break;
|
||||
case RECORDING:
|
||||
retVal = mRecordingSourceManager.getSource(config, channelSpecification);
|
||||
break;
|
||||
case NONE:
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -114,4 +114,10 @@ public class Recording implements Comparable<Recording>, ISourceEventProcessor
|
||||
return getRecordingConfiguration().getAlias()
|
||||
.compareTo( other.getRecordingConfiguration().getAlias() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof Recording)) return false;
|
||||
return compareTo((Recording) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,6 +528,7 @@ public class AirspyTunerEditor extends TunerConfigurationEditor
|
||||
mMixerAGC.setEnabled(true);
|
||||
mMixerGain.setEnabled(true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -88,4 +88,10 @@ public class TunerChannel implements Comparable<TunerChannel>
|
||||
{
|
||||
return Long.compare(getFrequency(), otherLock.getFrequency());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof TunerChannel)) return false;
|
||||
return compareTo((TunerChannel) o) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user