pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -18,53 +18,44 @@
package appeng.util.helpers;
import com.google.common.base.Preconditions;
import appeng.api.util.AEColor;
public class P2PHelper {
public class P2PHelper
{
public AEColor[] toColors(short frequency) {
final AEColor[] colors = new AEColor[4];
public AEColor[] toColors( short frequency )
{
final AEColor[] colors = new AEColor[4];
for (int i = 0; i < 4; i++) {
int nibble = (frequency >> 4 * (3 - i)) & 0xF;
for( int i = 0; i < 4; i++ )
{
int nibble = ( frequency >> 4 * ( 3 - i ) ) & 0xF;
colors[i] = AEColor.values()[nibble];
}
colors[i] = AEColor.values()[nibble];
}
return colors;
}
return colors;
}
public short fromColors(AEColor[] colors) {
Preconditions.checkArgument(colors.length == 4);
public short fromColors( AEColor[] colors )
{
Preconditions.checkArgument( colors.length == 4 );
int t = 0;
int t = 0;
for (int i = 0; i < 4; i++) {
int code = colors[3 - i].ordinal() << 4 * i;
for( int i = 0; i < 4; i++ )
{
int code = colors[3 - i].ordinal() << 4 * i;
t |= code;
}
t |= code;
}
return (short) (t & 0xFFFF);
}
return (short) ( t & 0xFFFF );
}
public String toHexDigit(AEColor color) {
return String.format("%01X", color.ordinal());
}
public String toHexDigit( AEColor color )
{
return String.format( "%01X", color.ordinal() );
}
public String toHexString( short frequency )
{
return String.format( "%04X", frequency );
}
public String toHexString(short frequency) {
return String.format("%04X", frequency);
}
}