Sample

int-9311400c3f37-I13

Lower every eligible classic and enhanced for loop to a while loop

Matched original source

Lines29

Scores

MethodScoreScale
Posnett0.9990–1; higher is more readable
Scalabrino0.7910–1; higher is more readable
Dorn0.7950–1; higher is more readable
Mi0.2960–1; higher is more readable
LLOC2Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.7760–1; higher is more readable

Views

Source code

package io.netty.util.internal; /** * Provides methods for {@link DefaultPriorityQueue} to maintain internal state. These methods should generally not be * used outside the scope of {@link DefaultPriorityQueue}. */ public interface PriorityQueueNode { /** * This should be used to initialize the storage returned by {@link #priorityQueueIndex(DefaultPriorityQueue)}. */ int INDEX_NOT_IN_QUEUE = -1; /** * Get the last value set by {@link #priorityQueueIndex(DefaultPriorityQueue, int)} for the value corresponding to * {@code queue}. * <p> * Throwing exceptions from this method will result in undefined behavior. */ int priorityQueueIndex(DefaultPriorityQueue<?> queue); /** * Used by {@link DefaultPriorityQueue} to maintain state for an element in the queue. * <p> * Throwing exceptions from this method will result in undefined behavior. * @param queue The queue for which the index is being set. * @param i The index as used by {@link DefaultPriorityQueue}. */ void priorityQueueIndex(DefaultPriorityQueue<?> queue, int i); }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.29+11.6
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.655−6.983
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.206.716−6.822

Intercept 8.87 + feature contributions = 6.666 (log-odds).
Score = sigmoid(6.666) = 0.999.

Score0.791

Feature contributions

FeatureValueContribution
(log-odds)
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.117.967−1.331
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.114.167+1.038
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.1+1.001
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.02+0.75
Indentation frequencyHow rapidly indentation changes from line to line.13−0.287
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.13+0.123
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.28.773−0.008

Intercept 0.07 + feature contributions = 1.354 (log-odds).
Score = sigmoid(1.354) = 0.795.

Score0.296
Score2
Run 1

The code is highly readable with clear structure and intent. It defines a small interface with two overloaded methods and a constant, logically organized with Javadoc explaining purpose and constraints. Nesting is nonexistent, and the flat structure aids comprehension. Clarity of intent is strong: method names and documentation clearly describe their roles in maintaining queue state. Code length is concise—no unnecessary complexity or verbosity. Action granularity follows interface conventions, with each method declaration on separate lines. Reading flow is natural: constant declaration, getter, setter. Minor deductions for relying on Javadoc to explain 'undefined behavior' rather than encoding constraints in the type system, and for the slightly ambiguous wording in the first method's documentation.

Run 2

The code is highly readable. It is a concise interface with clear purpose, documented via Javadoc. Structure is logical: a constant, a getter, and a setter. There is no nesting, and each method declaration occupies a single line. Naming is descriptive, and the documentation explains the contract and potential undefined behavior. Minor deductions: the constant could be final (though interface fields are implicitly static final), and some Javadoc phrasing is slightly verbose.

Run 3

The code is highly readable, with clear structure and intent. It defines a small, focused interface for managing priority queue node state. Javadoc comments provide useful context for method contracts and edge cases. Naming is descriptive and consistent. The interface is flat, with no nesting or complex control flow. Each method declaration is concise and serves a single purpose. The reading flow is natural — moving from the index constant, to the getter, then to the setter. The only minor deductions are for the generic type parameter `<?>` which slightly reduces clarity regarding allowed queue types, and the Javadoc could be slightly more explicit about thread-safety expectations. Overall, the code is straightforward and easy to understand.

Run 1

Code Structure: The interface logically groups a sentinel constant with index getter and setter methods. Nesting: There is no control-flow nesting, and the declarations are flat. Clarity of intent: Descriptive interface and constant names, typed signatures, and Javadocs clearly explain the queue-state contract; the setter parameter name 'i' is less descriptive than 'index'. Code length: The interface is concise, with documentation proportionate to its public contract. Action granularity: Each declaration occupies its own line and represents a single responsibility. Reading flow: The sequence from interface overview to initialization constant, getter, and setter is natural. Overloading the getter and setter under the same name slightly reduces immediate distinction, but their signatures and documentation resolve it.

Run 2

Code Structure: The interface logically groups a sentinel constant and two related index-access methods. Nesting: There is no nested control flow, making the code easy to scan. Clarity of intent: Javadoc clearly explains the interface's internal purpose, queue-specific state, and exception constraints; however, the overloaded getter/setter names and parameter name 'i' are slightly less explicit than dedicated accessor names and 'index'. Code length: The interface is concise, with documentation proportionate to its contract. Action granularity: Each constant or method declaration occupies its own line, with no combined actions. Reading flow: The package, interface documentation, initialization constant, getter, and setter follow a natural sequence.

Run 3

Code Structure: The interface logically groups a sentinel constant and related index getter/setter methods. Nesting: There is no nested control flow, making the code easy to scan. Clarity of intent: Javadoc clearly explains the interface's internal purpose, initialization requirements, and exception constraints; however, the setter parameter 'i' is less descriptive than 'index'. Code length: The interface is concise, with documentation proportionate to its contract. Action granularity: Each declaration occupies its own line, with no combined actions. Reading flow: The progression from interface purpose to constant, getter, and setter is natural. Using the same name for getter and setter is consistent, though slightly less explicit than distinct accessor names.