File ByteEntity.java
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.bytes;
/*
NetworkParser
The MIT License
ByteEntity
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
public class ByteEntity implements ByteItem {
/** The Constant BIT OF A BYTE. */
public static final int BITOFBYTE = 8;
public static final int TYPEBYTE = 1;
Method setValues
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean setValues(Object value) {
byte type = 0;
ByteBuffer msgValue = new ByteBuffer();
if (value == null) {
type = ByteTokener.DATATYPE_NULL;
Method writeBytes
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void writeBytes(ByteBuffer buffer, boolean isDynamic, boolean isLast, boolean isPrimitive) {
byte[] value = this.values;
byte type = getType();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method setValues
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public boolean setValues(Object value) {
byte type = 0;
ByteBuffer msgValue = new ByteBuffer();
if (value == null) {
type = ByteTokener.DATATYPE_NULL;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method calcLength
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
@Override
public int calcLength(boolean isDynamic, boolean isLast) {
/* Length calculate Sonderfaelle ermitteln */
if (this.values == null) {
return TYPEBYTE;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method writeBytes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void writeBytes(ByteBuffer buffer, boolean isDynamic, boolean isLast, boolean isPrimitive) {
byte[] value = this.values;
byte type = getType();
Avoid too many return
statements within this method. Open
return TYPEBYTE + EntityUtil.getTypeLen(type, values.length, isLast) + this.values.length;
Method toBinaryString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public String toBinaryString() {
if (values == null || values.length < 1) {
return "";
}
byte[] result = new byte[values.length * 9 + 9];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"