Sample

int-94b68113b436-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines28

Scores

MethodScoreScale
Posnett0.0060–1; higher is more readable
Scalabrino0.7610–1; higher is more readable
Dorn0.8420–1; higher is more readable
Mi0.6990–1; higher is more readable
LLOC7Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.70–1; higher is more readable

Views

Source code

package io.netty.example.sctp; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; /** * Handler implementation for the SCTP echo server. */ @Sharable public class SctpEchoServerHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { ctx.write(msg); } @Override public void channelReadComplete(ChannelHandlerContext ctx) { ctx.flush(); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { // Close the connection when an exception is raised. cause.printStackTrace(); ctx.close(); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.553.182−18.255
Source linesThe number of non-empty source lines.28+11.2
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.646−6.97

Intercept 8.87 + feature contributions = -5.155 (log-odds).
Score = sigmoid(-5.155) = 0.006.

Score0.761

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.76.966+0.437
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.76.897+0.408
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.072+0.244
Indentation frequencyHow rapidly indentation changes from line to line.25+0.128
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.27.705−0.023
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.29+0.01

Intercept 0.07 + feature contributions = 1.672 (log-odds).
Score = sigmoid(1.672) = 0.842.

Score0.699
Score7
Run 1

The code is highly readable. It has a clear, logical structure with imports, class declaration, and concise method overrides. Nesting is minimal, with no nested blocks or conditionals. Each method expresses a single intent: reading data, flushing, and handling exceptions. Code length is appropriate for an echo handler — no unnecessary boilerplate. Action granularity is well-maintained, with one action per line (e.g., `ctx.write(msg)` and `cause.printStackTrace()`). Reading flow is natural: the class is named clearly, methods are ordered logically, and the Javadoc comment explains the class purpose. Minor deduction for the inline comment in `exceptionCaught` being slightly redundant, but overall the code is nearly exemplary.

Run 2

The code is very readable. It has a clear logical structure: imports, Javadoc, class declaration, and three well-defined handler methods. Nesting is flat with no conditional blocks. Each method's intent is obvious from its name and concise implementation. The code is appropriately short—no boilerplate beyond what the framework requires. Action granularity is good, with one primary action per meaningful line; exceptionCaught has two clear steps (print, close). Reading flow follows a natural, standard Netty handler pattern, making it easy for someone familiar with Netty to follow. Minor deductions: the comment in exceptionCaught is somewhat redundant with the method name, and missing Javadoc on public methods could slightly improve clarity.

Run 3

The code demonstrates good readability with a clear and concise structure. The class is properly documented, follows Java naming conventions, and implements a straightforward handler pattern. Each method has a single responsibility: channelRead writes the message, channelReadComplete flushes, and exceptionCaught handles errors. Nesting is minimal (no nested blocks), and there is one action per line, making the flow easy to follow. The import statements are minimal and relevant. While the exception handling could be slightly improved (e.g., logging instead of printStackTrace), the overall intent is clear. The code is appropriately short for a basic echo server handler and has a natural reading flow from import to class to methods.

Run 1

Code Structure: Clearly organized into a documented handler class with three focused event callbacks. Nesting: Minimal nesting, with no conditional branches or loops. Clarity of intent: The class name, documentation, and callback names make the echo-server behavior clear; Netty knowledge is needed to understand the write/flush lifecycle. Code length: Concise, with no unnecessary logic or repetition. Action granularity: Each statement performs one action on its own line. Reading flow: Natural progression from receiving messages to flushing writes and handling exceptions. Minor formatting improvement: Add a blank line between the package declaration and imports.

Run 2

Code Structure: Logically organized into three clearly separated event-handler methods. Nesting: Flat, with no conditional blocks or nested control flow. Clarity of intent: The class name, documentation, and method names clearly communicate an SCTP echo handler; understanding the write/flush separation requires some Netty familiarity. Code length: Concise, with no unnecessary implementation detail. Action granularity: Each statement performs one action on its own line. Reading flow: Natural progression from receiving data to flushing writes and handling exceptions. A blank line between the package declaration and imports would slightly improve visual separation.

Run 3

Code Structure: The handler is logically organized into three clearly separated event callbacks. Nesting: Methods are flat, with no nested control flow. Clarity of intent: The class name, documentation, and method names clearly convey an SCTP echo handler; understanding write-versus-flush behavior requires some Netty familiarity. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs one action on its own line. Reading flow: Reading progresses naturally from receiving data to flushing writes and handling exceptions. A blank line between the package declaration and imports would slightly improve formatting.