Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix message filtering in message tab #1177

Merged
merged 2 commits into from Apr 30, 2022

Conversation

apankowski
Copy link
Contributor

This PR fixes message filtering to the message tab.

In master, the DecoderFactory.getMessageFilters is not referenced at all. It seems that it was (probably mistakenly) deleted in commit 7eec82d "#6 DMR Decoder (#947)" which removed building of filter list in ChannelProcessingManager.

What I wasn't sure is if building of the filter list should happen in MessageActivityPanel (as in this PR) or during creation of the ProcessingChain (and only referenced from MessageActivityPanel).

Apart from that, I included fixes of small code issues spotted around the code base. I will leave comments on these describing reason for the change.

Copy link
Contributor Author

@apankowski apankowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments describing small fixes

@@ -35,29 +35,29 @@
* Logical (ie constructed) size of this bitset, despite the actual size of
* the super bitset that this class is based on
*/
private int mSize = 0;
private int mSize;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

field is set in constructor either way

Comment on lines -46 to -53
/**
* Bitset that buffers bits added one at a time, up to the size of the this
* bitset.
*
* Note: the super class bitset behind this class may have a size larger
* that the size parameter specified.
* @param size
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved dangling JavaDoc to constructor

@@ -75,7 +75,7 @@ private void addFilterSet(FilterSet<T> filterSet, DefaultMutableTreeNode parent)
List<IFilter<T>> filters = filterSet.getFilters();

/* sort the filters in alphabetical order by name */
filters.sort((Comparator<IFilter<?>>) (first, second) -> first.getName().compareTo(second.getName()));
filters.sort(Comparator.comparing(IFilter::getName));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build comparator from method reference

@@ -98,7 +98,7 @@ private void addFilter(Filter<T> filter, DefaultMutableTreeNode parent)
{
List<FilterElement<?>> elements = filter.getFilterElements();

elements.sort(Comparator.comparing(FilterElement::toString));
elements.sort(Comparator.comparing(FilterElement::getName));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

order filter elements by their display name (as above) instead of synthetic toString

@@ -25,17 +25,17 @@
public interface IByteBufferProvider
{
/**
* Adds the listener to receive complex buffer samples
* Adds the listener to receive byte buffer samples
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

match JavaDoc with purpose of the class

@@ -8,7 +8,6 @@
import java.util.Date;

import static io.github.dsheirer.service.radioreference.RadioReference.CheckExpDate;
import static org.junit.Assert.*;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused JUnit 4 import

@@ -105,7 +105,7 @@ public WaveWriter(AudioFormat format, Path file, long maxSize) throws IOExceptio
*/
public WaveWriter(AudioFormat format, Path file) throws IOException
{
this(format, file, Integer.MAX_VALUE * 2);
this(format, file, 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of Java type conversion and promotion rules, multiplication of Integer.MAX_VALUE (of type int) and 2 (of type int) will overflow (to type int) even though the third argument is of type long.

what we likely want here is to default to MAX_WAVE_SIZE, so we can pass 0 or just MAX_WAVE_SIZE if you prefer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks maybe this will fix wav recordings (a feature i use) maybe some calls getting cut off after 8 minutes or so on long (large) files

@DSheirer DSheirer merged commit 1152b13 into DSheirer:master Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants