Sample
int-b36ca9aba86f-I13
Lower every eligible classic and enhanced for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.826 | 0–1; higher is more readable |
| Dorn | 0.24 | 0–1; higher is more readable |
| Mi | 0.115 | 0–1; higher is more readable |
| LLOC | 37 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.532 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 2160.249 | −71.288 |
| Source linesThe number of non-empty source lines. | 96 | +38.4 |
| 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.51 | −6.765 |
Intercept 8.87 + feature contributions = -30.783 (log-odds).
Score = sigmoid(-30.783) = 0.
| Score | 0.826 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 97 | −2.398 |
| 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. | 139.959 | −2.263 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 85 | +2.203 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 85 | −1.53 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 139.969 | +1.454 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 95.787 | +0.929 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.058 | +0.382 |
Intercept 0.07 + feature contributions = -1.153 (log-odds).
Score = sigmoid(-1.153) = 0.24.
| Score | 0.115 |
|---|
| Score | 37 |
|---|
Run 1
The code is well-structured with clear separation of concerns: the enum, constructor, accessors, and standard object methods are logically organized. Nesting is minimal and readable. Field and parameter names communicate intent effectively, supported by thorough Javadoc. The code is concise without sacrificing clarity, though the Javadoc is somewhat verbose. Each method performs a single action per line, contributing to strong readability. The fromCode method uses a simple if-else chain rather than a switch, which is slightly less elegant but still clear. Constructor validation is straightforward and well-ordered. Overall, the code is highly readable, with only minor opportunities for improvement such as using a switch expression or Objects.equals for consistency.
Run 2
The code is well-structured and highly readable. It follows a logical organization with clear separation of concerns: enum definition, constructor with validation, accessors, and standard overrides. Nesting is minimal; the enum's fromCode method uses simple if-else chains rather than nested logic. Intent is clearly expressed through descriptive naming and comprehensive Javadoc, especially for the constructor parameters. Code length is appropriate — no unnecessary verbosity or excessive brevity. Action granularity is good, with single operations per line in most cases. Reading flow is natural: package/imports, class declaration, enum, fields, constructor, methods, then overrides. Minor deductions: the constructor's first validation condition could be slightly clearer (checking equals against enum with three branches instead of using !=), and the Javadoc has minor formatting inconsistencies. Overall, it's production-quality public API code that balances documentation, validation, and readability well.
Run 3
The code is highly readable with clear logical organization, flat nesting, and minimal complexity. The class structure separates constants, enum, constructor, accessors, and standard methods cleanly. The enum's fromCode method uses straightforward if-else branches without deep nesting. The constructor validates inputs with clear error messages, and the javadoc effectively communicates intent and special cases. Lines are concise, each performing one logical action. The reading flow is natural—declarations, enum, constructor, methods, then standard overrides—making it easy to follow. Minor deductions: the enum could use a switch statement or Map for slightly cleaner mapping, and the equals method has a small redundance with instanceof and cast, but these do not significantly impact readability.
Run 1
Code Structure: Logically organized into immutable fields, a related enum, constructor validation, accessors, and standard object methods. Nesting: Shallow conditionals and early returns keep complexity low. Clarity of intent: Descriptive names and documentation clearly explain feature updates and downgrade modes; the validation message saying '< 1' while its condition checks zero is slightly imprecise. Code length: Appropriately concise overall, though the enum conversion chain and lengthy constructor documentation could be streamlined. Action granularity: Statements generally perform one action per line, with compound conditions remaining easy to understand. Reading flow: Conventional Java ordering supports natural reading; minor import spacing and long lines slightly reduce polish.
Run 2
Code Structure: Well-organized value class with fields, a related enum, constructor validation, accessors, and standard object methods. Nesting: Shallow control flow and early returns make branches easy to follow. Clarity of intent: Descriptive names and documentation clearly explain feature updates and downgrade modes; the error message's '< 1' wording is slightly inconsistent with its zero-only condition. Code length: Mostly concise, though fromCode's repetitive if/else chain could be simplified. Action granularity: Statements generally perform one action each; longer validation and equality expressions remain understandable. Reading flow: Natural ordering and consistent formatting support easy reading, with minor distractions from long lines, uneven Javadoc alignment, and missing spacing after the package declaration.
Run 3
Code Structure: Fields, the enum, constructor, accessors, and standard object methods are logically organized. Nesting: Shallow conditionals and early returns keep complexity low. Clarity of intent: Descriptive names and constructor documentation clearly explain feature updates and downgrade modes; the error message's '< 1' wording does not precisely match its zero-only condition. Code length: Mostly concise, though fromCode's repetitive if/else chain could be simplified. Action granularity: Statements generally perform one action per line, with only a few long expressions and messages. Reading flow: Consistent formatting and conventional method ordering make the class easy to follow; missing spacing around imports and lengthy documentation lines slightly reduce readability.