mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Updates pull request from Roman Tsypuk to convert the build system from
ant to gradle. Removes linux and windows application launch scripts and produces an executable jar with all resources included.
This commit is contained in:
48
src/main/java/io/github/dsheirer/bits/SoftSyncDetector.java
Normal file
48
src/main/java/io/github/dsheirer/bits/SoftSyncDetector.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package io.github.dsheirer.bits;
|
||||
|
||||
public class SoftSyncDetector implements ISyncProcessor
|
||||
{
|
||||
private ISyncDetectListener mListener;
|
||||
private long mPattern;
|
||||
private int mThreshold;
|
||||
|
||||
public SoftSyncDetector( ISyncDetectListener listener, long pattern, int threshold )
|
||||
{
|
||||
this( pattern, threshold );
|
||||
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public SoftSyncDetector( long pattern, int threshold )
|
||||
{
|
||||
mPattern = pattern;
|
||||
mThreshold = threshold;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkSync( long value )
|
||||
{
|
||||
long difference = value ^ mPattern;
|
||||
|
||||
if( ( difference == 0 || Long.bitCount( difference ) <= mThreshold ) &&
|
||||
mListener != null )
|
||||
{
|
||||
mListener.syncDetected();
|
||||
}
|
||||
}
|
||||
|
||||
public void setThreshold( int threshold )
|
||||
{
|
||||
mThreshold = threshold;
|
||||
}
|
||||
|
||||
public void setListener( ISyncDetectListener listener )
|
||||
{
|
||||
mListener = listener;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user