Sample
int-e90299383379-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.615 | 0–1; higher is more readable |
| Dorn | 0.284 | 0–1; higher is more readable |
| Mi | 0.575 | 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 | 17 | 0–20; mean of three runs |
| BTTF | 0.35 | 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. | 3320.065 | −109.562 |
| Source linesThe number of non-empty source lines. | 129 | +51.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.724 | −7.086 |
Intercept 8.87 + feature contributions = -56.178 (log-odds).
Score = sigmoid(-56.178) = 0.
| Score | 0.615 |
|---|
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. | 130 | −3.567 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 86 | +2.238 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 86 | −1.553 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 128.772 | +1.39 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 97.631 | +0.771 |
| 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. | 99.977 | −0.569 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.066 | +0.296 |
Intercept 0.07 + feature contributions = -0.924 (log-odds).
Score = sigmoid(-0.924) = 0.284.
| Score | 0.575 |
|---|
| Score | 37 |
|---|
Run 1
The code is well-structured and readable. The class hierarchy is logical, with a clear base class handling shared iteration logic and subclasses for directed/undirected cases. Nesting is moderate—only two levels deep in computeNext methods, which is acceptable. Intent is clearly documented with Javadoc and inline comments explaining non-obvious decisions like null handling and visited-node tracking. Code length is appropriate; comments add necessary context without excessive verbosity. Action granularity is good: most lines perform a single operation, and method calls are isolated. Reading flow is natural, with helper methods like advance() breaking down complex logic. Minor deductions: the Undirected.computeNext method has a slightly tangled flow with the inner while loop and null-safety annotations; the visitedNodes null assignment is explained but still requires careful reading. Overall, this is production-quality, maintainable code from Guava.
Run 2
The code demonstrates clear structure and intent, with well-documented classes and methods. The iterator pattern is implemented logically, separating directed and undirected cases cleanly. Nesting is moderate but controlled, with the main loops in computeNext() methods being flat enough to follow. Variable names are descriptive, and comments explain non-obvious logic like the null visitedNodes convention and the self-loop handling. However, some areas slightly reduce readability: the initial state uses a dummy empty iterator, which is a bit obscure without deep understanding, and the nullability handling with requireNonNull calls, while documented, adds cognitive overhead. The historical comment about '0x1' in set sizing is confusing. Overall, it's concise but could be clearer on initial state setup.
Run 3
The code is highly readable. It has a clear package and import structure, a concise class hierarchy, and well-documented inner classes. The nesting is only two levels deep in the computeNext methods, which keeps the logic flat and easy to follow. Each method has a clear single purpose: `advance` updates iteration state, and `computeNext` returns the next endpoint pair. Comments explain the tricky parts, especially the visited-node logic in `Undirected` and the non-null assumptions. Variable names are descriptive, and one action per line is mostly respected. The class-level javadoc and method-level documentation make the intent obvious without being verbose. Minor deductions for the slightly unusual `0x1` addition in `newHashSetWithExpectedSize` and the reliance on comments for null-safety, but overall this is an excellent example of maintainable code.
Run 1
Code Structure: Well organized into a shared iterator base and separate directed and undirected implementations, with common advancement logic centralized. Nesting: Mostly shallow; the undirected implementation introduces a manageable nested loop and conditional. Clarity of intent: Descriptive names and explanatory comments make edge traversal, duplicate suppression, and self-loop handling clear. Nullable state, adding null to the visited set, and the hexadecimal 0x1 introduce minor cognitive overhead. Code length: Implementation is concise, although the extensive undirected example adds substantial documentation length. Action granularity: Statements generally perform one action per line; iterator advancement within return expressions remains understandable. Reading flow: Initialization, successor processing, node advancement, and termination follow a logical sequence. However, understanding the state invariants requires tracking fields across advance() and computeNext(), slightly reducing immediate readability.
Run 2
Code Structure: Shared traversal logic is cleanly separated from directed and undirected implementations. Nesting: The directed iterator is shallow; the undirected iterator has moderate nesting, but its loops and early returns remain manageable. Clarity of intent: Descriptive names and comments explain traversal invariants, duplicate suppression, and self-loop handling. However, null sentinels, nullable state, and the unexplained hexadecimal 0x1 introduce minor cognitive overhead. Code length: Implementation is concise, although the extensive undirected example adds substantial documentation length. Action granularity: Statements generally perform one action per line, with clear state updates. Reading flow: Factory, initialization, shared advancement, and specialized traversal follow a logical sequence. Understanding computeNext requires tracking state across calls and knowing AbstractIterator's lifecycle, slightly reducing readability.
Run 3
Code Structure: Shared iteration logic is cleanly separated from directed and undirected implementations. Nesting: Directed iteration is shallow; undirected iteration has moderate nesting through two loops and a conditional, but remains manageable. Clarity of intent: Descriptive names and comments explain duplicate avoidance, self-loops, and null-safety invariants. However, adding null to the visited set and clearing it on completion introduce subtle state management. Code length: Implementation is reasonably concise, though the extensive example and repeated null-safety comments increase reading length. Action granularity: Statements generally perform one action per line, with straightforward assignments and returns. Reading flow: Initialization, advancement, and edge production follow a logical progression, although understanding the undirected iterator requires tracking state across calls. Minor distractions include the hexadecimal 0x1 and tightly grouped imports.