Sample
int-ad514ea4a10d-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.622 | 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 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.5 | 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. | 3304.828 | −109.059 |
| 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.721 | −7.082 |
Intercept 8.87 + feature contributions = -55.671 (log-odds).
Score = sigmoid(-55.671) = 0.
| Score | 0.622 |
|---|
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.752 | +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: a shared abstract base handles common iteration logic, while Directed and Undirected subclasses encapsulate their specific behaviors. Methods are short and focused, with one primary action per line in most cases. Comments explain non-obvious decisions, such as null-safety reasoning, the undirected duplicate-avoidance strategy, and self-loop handling. Nesting is shallow, and control flow—particularly the `while (true)` loops with early returns—follows a natural iterator pattern, making intent clear. Minor deductions: some null-handling requires careful reasoning and inline comments; the `visitedNodes` initialization with a size hint is slightly opaque; and a few lines, like `visitedNodes.add(node)` before `advance()`, depend on implicit state, which requires an explanatory comment. Overall, it strikes a strong balance between conciseness and clarity.
Run 2
The code is highly readable with clear structure and intent. It uses a well-organized class hierarchy with a base class and two nested subclasses for directed/undirected cases. Nesting is minimal—though there are several `while` loops and an `if` inside, depth stays manageable. Each method has a single responsibility, and one action is performed per line in most places. The use of comments and Javadocs meaningfully clarifies tricky logic (e.g., null-safety rationale, self-loop handling, duplicate avoidance). Variable names are descriptive. The undirected algorithm's approach is slightly non-obvious, but the thorough explanation and example mitigate confusion. Some minor verbosity—like repeated `requireNonNull(visitedNodes)` and `requireNonNull(node)`—adds safety but also length. Overall, the code is well-crafted for a library context, balancing clarity and conciseness effectively.
Run 3
This code is highly readable. It demonstrates clear structure with logical separation between the abstract base class and directed/undirected implementations. Nesting is minimal, with only a couple of loops and conditionals. The intent of each class and method is well-documented, especially the complex logic in the Undirected inner class. Code length is appropriate for the functionality, and action granularity is generally one action per line. Reading flow is natural, with comments explaining non-obvious decisions. Minor drawbacks include the null assignment pattern for 'visitedNodes' and field initialization quirks, but these are adequately commented.
Run 1
Code Structure: Well organized into a shared iterator base and separate directed/undirected implementations, with advancement logic centralized. Nesting: Mostly shallow; the undirected implementation adds a manageable nested loop and conditional. Clarity of intent: Descriptive names and comments explain traversal, duplicate suppression, self-loops, and null-safety assumptions. The initial null entry in visitedNodes and its later null assignment introduce some cognitive overhead. Code length: Implementation is concise; the lengthy documentation example is useful but increases reading time. Action granularity: Statements generally perform one action per line, with straightforward state updates. Reading flow: Factory, initialization, shared advancement, and specialized traversal follow a natural progression. Stateful iteration and while(true) loops require tracking invariants, but clear termination paths and explanatory comments keep the code highly readable.
Run 2
Code Structure: Well organized into a shared iterator base and separate directed/undirected implementations, with common advancement logic factored out. Nesting: Mostly shallow; the undirected implementation has moderate loop-and-condition nesting that remains manageable. Clarity of intent: Descriptive names and detailed comments explain duplicate suppression, self-loops, and null-safety invariants, though nullable state and adding null to the visited set require extra thought. Code length: Implementation is concise; the lengthy illustrative documentation is useful but increases reading time. Action granularity: Statements generally perform one action per line, with conventional iterator calls embedded in return expressions. Reading flow: Factory, initialization, advancement, and specialized traversal follow a logical progression. Stateful iteration and while(true) loops slightly complicate tracing, but explicit termination checks and comments keep the flow understandable.
Run 3
Code Structure: Shared traversal logic is cleanly separated from directed and undirected implementations. Nesting: Generally shallow, though the undirected iterator uses nested loops and a conditional. Clarity of intent: Descriptive names and detailed comments explain duplicate avoidance, self-loops, and null-safety invariants; nullable state and the initial null entry require extra thought. Code length: Implementation is concise, although the extensive example and repeated safety comments increase reading length. Action granularity: Statements generally perform one action per line, with clear state transitions. Reading flow: Factory, constructor, shared helper, and specialized implementations follow a logical order. Stateful iteration and reliance on AbstractIterator lifecycle conventions slightly reduce immediate readability.