Skip to content

Commit

Permalink
squid:S1213 - The members of an interface declaration or class should…
Browse files Browse the repository at this point in the history
… appear in a pre-defined order
  • Loading branch information
Mohamed Ezzat committed May 26, 2016
1 parent 88b9a82 commit 2873f28
Show file tree
Hide file tree
Showing 25 changed files with 486 additions and 473 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@

public final class AirTunesCrytography
{
/**
* Class is not meant to be instantiated
*/
private AirTunesCrytography()
{
throw new RuntimeException();
}

private static final Logger s_logger = Logger.getLogger(AirTunesCrytography.class.getName());

/**
Expand All @@ -64,6 +56,15 @@ private AirTunesCrytography()
* @param transformation
* the transformation to find an implementation for
*/

/**
* Class is not meant to be instantiated
*/
private AirTunesCrytography()
{
throw new RuntimeException();
}

public static Cipher getCipher(final String transformation)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,66 @@ public class RaopAudioHandler extends SimpleChannelUpstreamHandler
{
private static Logger logger = LoggerFactory.getLogger(RaopAudioHandler.class.getName());

/**
* {@code Transport} header option format. Format of a single option is <br>
* {@code <name>=<value>} <br>
* format of the {@code Transport} header is <br>
* {@code <protocol>;<name1>=<value1>;<name2>=<value2>;...}
* <p>
* For RAOP/AirTunes, {@code <protocol>} is always {@code RTP/AVP/UDP}.
*/
private static Pattern s_pattern_transportOption = Pattern.compile("^([A-Za-z0-9_-]+)(=(.*))?$");

/**
* SET_PARAMETER syntax. Format is <br>
* {@code <parameter>: <value>}
* <p>
*/
private static Pattern s_pattern_parameter = Pattern.compile("^([A-Za-z0-9_-]+): *(.*)$");

/**
* SDP line. Format is <br>
* {@code
* <attribute>=<value>
* }
*/
private static Pattern s_pattern_sdp_line = Pattern.compile("^([a-z])=(.*)$");

/**
* SDP attribute {@code m}. Format is <br>
* {@code
* <media> <port> <transport> <formats>
* }
* <p>
* RAOP/AirTunes always required {@code <media>=audio, <transport>=RTP/AVP} and only a single format is allowed. The port is ignored.
*/
private static Pattern s_pattern_sdp_m = Pattern.compile("^audio ([^ ]+) RTP/AVP ([0-9]+)$");

/**
* SDP attribute {@code a}. Format is <br>
* {@code <flag>} <br>
* or <br>
* {@code <attribute>:<value>}
* <p>
* RAOP/AirTunes uses only the second case, with the attributes
* <ul>
* <li> {@code <attribute>=rtpmap}
* <li> {@code <attribute>=fmtp}
* <li> {@code <attribute>=rsaaeskey}
* <li> {@code <attribute>=aesiv}
* </ul>
*/
// private static Pattern s_pattern_sdp_a = Pattern.compile("^([a-z]+):(.*)$");
// Added min-latency and max-latency tollerence
private static Pattern s_pattern_sdp_a = Pattern.compile("^([a-z]+.?[a-z]+):(.*)$");
/**
* SDP {@code a} attribute {@code rtpmap}. Format is <br>
* {@code <format> <encoding>} for RAOP/AirTunes instead of {@code <format> <encoding>/<clock rate>}.
* <p>
* RAOP/AirTunes always uses encoding {@code AppleLossless}
*/
private static Pattern s_pattern_sdp_a_rtpmap = Pattern.compile("^([0-9]+) (.*)$");

/**
* The RTP channel type
*/
Expand Down Expand Up @@ -317,49 +377,6 @@ else if(RaopRtspMethods.GET_PARAMETER.equals(method))
super.messageReceived(ctx, evt);
}

/**
* SDP line. Format is <br>
* {@code
* <attribute>=<value>
* }
*/
private static Pattern s_pattern_sdp_line = Pattern.compile("^([a-z])=(.*)$");

/**
* SDP attribute {@code m}. Format is <br>
* {@code
* <media> <port> <transport> <formats>
* }
* <p>
* RAOP/AirTunes always required {@code <media>=audio, <transport>=RTP/AVP} and only a single format is allowed. The port is ignored.
*/
private static Pattern s_pattern_sdp_m = Pattern.compile("^audio ([^ ]+) RTP/AVP ([0-9]+)$");

/**
* SDP attribute {@code a}. Format is <br>
* {@code <flag>} <br>
* or <br>
* {@code <attribute>:<value>}
* <p>
* RAOP/AirTunes uses only the second case, with the attributes
* <ul>
* <li> {@code <attribute>=rtpmap}
* <li> {@code <attribute>=fmtp}
* <li> {@code <attribute>=rsaaeskey}
* <li> {@code <attribute>=aesiv}
* </ul>
*/
// private static Pattern s_pattern_sdp_a = Pattern.compile("^([a-z]+):(.*)$");
// Added min-latency and max-latency tollerence
private static Pattern s_pattern_sdp_a = Pattern.compile("^([a-z]+.?[a-z]+):(.*)$");
/**
* SDP {@code a} attribute {@code rtpmap}. Format is <br>
* {@code <format> <encoding>} for RAOP/AirTunes instead of {@code <format> <encoding>/<clock rate>}.
* <p>
* RAOP/AirTunes always uses encoding {@code AppleLossless}
*/
private static Pattern s_pattern_sdp_a_rtpmap = Pattern.compile("^([0-9]+) (.*)$");

/**
* Handles ANNOUNCE requests and creates an {@link AudioOutputQueue} and the following handlers for RTP channels
* <ul>
Expand Down Expand Up @@ -503,16 +520,6 @@ else if("aesiv".equals(key))
ctx.getChannel().write(response);
}

/**
* {@code Transport} header option format. Format of a single option is <br>
* {@code <name>=<value>} <br>
* format of the {@code Transport} header is <br>
* {@code <protocol>;<name1>=<value1>;<name2>=<value2>;...}
* <p>
* For RAOP/AirTunes, {@code <protocol>} is always {@code RTP/AVP/UDP}.
*/
private static Pattern s_pattern_transportOption = Pattern.compile("^([A-Za-z0-9_-]+)(=(.*))?$");

/**
* Handles SETUP requests and creates the audio, control and timing RTP channels
*/
Expand Down Expand Up @@ -645,13 +652,6 @@ public void operationComplete(final ChannelFuture future) throws Exception
});
}

/**
* SET_PARAMETER syntax. Format is <br>
* {@code <parameter>: <value>}
* <p>
*/
private static Pattern s_pattern_parameter = Pattern.compile("^([A-Za-z0-9_-]+): *(.*)$");

/**
* Handle SET_PARAMETER request. Currently only {@code volume} is supported
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@
*/
public abstract class RaopRtpPacket extends RtpPacket
{
protected RaopRtpPacket(final int length)
{
super(length);
setVersion((byte) 2);
}

protected RaopRtpPacket(final ChannelBuffer buffer, final int minimumSize) throws ProtocolException
{
super(buffer, minimumSize);
}

protected RaopRtpPacket(final ChannelBuffer buffer)
{
super(buffer);
}

/**
* Reads an 32-bit unsigned integer from a channel buffer
*
Expand Down Expand Up @@ -692,19 +708,4 @@ public static RaopRtpPacket decode(final ChannelBuffer buffer) throws ProtocolEx
}
}

protected RaopRtpPacket(final int length)
{
super(length);
setVersion((byte) 2);
}

protected RaopRtpPacket(final ChannelBuffer buffer, final int minimumSize) throws ProtocolException
{
super(buffer, minimumSize);
}

protected RaopRtpPacket(final ChannelBuffer buffer)
{
super(buffer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

public final class Taylor
{
public static final Coefficients SincCoefficients = new Coefficients() {
@Override
public double coefficient(int power)
{
if((power % 2) != 0)
return 0.0;

double coeff = ((power / 2) % 2 == 0) ? 1.0 : -1.0;
for(int i = 1; i <= (power + 1); ++i)
coeff /= i;

return coeff;
}
};

public interface Coefficients
{
public double coefficient(int power);
Expand All @@ -27,21 +42,6 @@ public static double taylor(double x, Coefficients source)
return result;
}

public static final Coefficients SincCoefficients = new Coefficients() {
@Override
public double coefficient(int power)
{
if((power % 2) != 0)
return 0.0;

double coeff = ((power / 2) % 2 == 0) ? 1.0 : -1.0;
for(int i = 1; i <= (power + 1); ++i)
coeff /= i;

return coeff;
}
};

public static double sinc(double x)
{
return taylor(x, SincCoefficients);
Expand Down
Loading

0 comments on commit 2873f28

Please sign in to comment.