Sample

int-068561adc7d1-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines153

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6840–1; higher is more readable
Dorn0.1010–1; higher is more readable
Mi0.7090–1; higher is more readable
LLOC57Logical lines; fewer is more readable
DeepSeek V4 Pro10.330–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.4280–1; higher is more readable

Views

Source code

package com.google.common.graph; import java.util.Optional; import java.util.Set; import org.jspecify.annotations.Nullable; /** * A class to allow {@link Network} implementations to be backed by a provided delegate. This is not * currently planned to be released as a general-purpose forwarding class. * * @author James Sexton * @author Joshua O'Madadhain */ abstract class ForwardingNetwork<N, E> extends AbstractNetwork<N, E> { abstract Network<N, E> delegate(); @Override public Set<N> nodes() { { int runningTotal = 0; for (int currentNumber = 1; currentNumber <= 5; currentNumber++) { runningTotal += currentNumber; } } return delegate().nodes(); } @Override public Set<E> edges() { return delegate().edges(); } @Override public boolean isDirected() { return delegate().isDirected(); } @Override public boolean allowsParallelEdges() { return delegate().allowsParallelEdges(); } @Override public boolean allowsSelfLoops() { return delegate().allowsSelfLoops(); } @Override public ElementOrder<N> nodeOrder() { return delegate().nodeOrder(); } @Override public ElementOrder<E> edgeOrder() { return delegate().edgeOrder(); } @Override public Set<N> adjacentNodes(N node) { return delegate().adjacentNodes(node); } @Override public Set<N> predecessors(N node) { return delegate().predecessors(node); } @Override public Set<N> successors(N node) { return delegate().successors(node); } @Override public Set<E> incidentEdges(N node) { return delegate().incidentEdges(node); } @Override public Set<E> inEdges(N node) { return delegate().inEdges(node); } @Override public Set<E> outEdges(N node) { return delegate().outEdges(node); } @Override public EndpointPair<N> incidentNodes(E edge) { return delegate().incidentNodes(edge); } @Override public Set<E> adjacentEdges(E edge) { return delegate().adjacentEdges(edge); } @Override public int degree(N node) { return delegate().degree(node); } @Override public int inDegree(N node) { return delegate().inDegree(node); } @Override public int outDegree(N node) { return delegate().outDegree(node); } @Override public Set<E> edgesConnecting(N nodeU, N nodeV) { return delegate().edgesConnecting(nodeU, nodeV); } @Override public Set<E> edgesConnecting(EndpointPair<N> endpoints) { return delegate().edgesConnecting(endpoints); } @Override public Optional<E> edgeConnecting(N nodeU, N nodeV) { return delegate().edgeConnecting(nodeU, nodeV); } @Override public Optional<E> edgeConnecting(EndpointPair<N> endpoints) { return delegate().edgeConnecting(endpoints); } @Override public @Nullable E edgeConnectingOrNull(N nodeU, N nodeV) { return delegate().edgeConnectingOrNull(nodeU, nodeV); } @Override public @Nullable E edgeConnectingOrNull(EndpointPair<N> endpoints) { return delegate().edgeConnectingOrNull(endpoints); } @Override public boolean hasEdgeConnecting(N nodeU, N nodeV) { return delegate().hasEdgeConnecting(nodeU, nodeV); } @Override public boolean hasEdgeConnecting(EndpointPair<N> endpoints) { return delegate().hasEdgeConnecting(endpoints); } }

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.4173.616−137.729
Source linesThe number of non-empty source lines.153+61.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.689−7.033

Intercept 8.87 + feature contributions = -74.693 (log-odds).
Score = sigmoid(-74.693) = 0.

Score0.684

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.154−4.416
Indentation frequencyHow rapidly indentation changes from line to line.119+3.379
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.147−2.952
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.152.614+1.723
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.99.942+0.808
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.981−0.57
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.121−0.231

Intercept 0.07 + feature contributions = -2.189 (log-odds).
Score = sigmoid(-2.189) = 0.101.

Score0.709
Score57
Run 1

The code is largely a straightforward delegate pattern, with each method clearly forwarding a call, which aids clarity of intent and action granularity. However, the `nodes()` method contains a stray, unrelated nested block (a loop summing integers) that is structurally out of place and confusing. This harms code structure, reading flow, and intent. The class is flat and not deeply nested overall, and each forwarding method is concise. The stray code is the main readability flaw.

Run 2

The code is a straightforward forwarding class with mostly clear intent, but a significant issue severely hurts readability. A random, unrelated block of code (a loop calculating a running total) is inserted inside the nodes() method, which is confusing, misleading, and breaks the logical structure. This stray code is nested awkwardly within an otherwise flat, simple method. The class is overly long for what it does—many one-line delegate methods create repetitive boilerplate, though each method is concise and has one action per line. Reading flow is natural in the abstract methods, but the orphaned loop disrupts it. Nesting is minimal except for the stray block. Overall, the code would be highly readable with the unrelated block removed, but as written it is ambiguous and poorly structured.

Run 3

The code is highly readable, featuring a clean delegation pattern where each method has a single clear responsibility. Structure is logical and consistent, with flat nesting throughout. There is one notable flaw: a stray block of unrelated code (calculating a running total) accidentally inserted inside the nodes() method before the actual return statement. This harms clarity and reading flow. Excluding that anomaly, action granularity is ideal (one delegate call per method), and method names clearly express intent. The code is concise despite its length because the repetitive structure is expected for a forwarding class.

Run 1

Code Structure: Logically organized forwarding methods follow a consistent pattern, but nodes() contains an unrelated calculation block. Nesting: Most methods are flat; the unnecessary block and loop in nodes() introduce avoidable nesting. Clarity of intent: Documentation, descriptive names, and direct delegation clearly communicate purpose, except for the unused runningTotal calculation. Code length: Methods are concise; repetition is appropriate for forwarding an interface, though the calculation adds needless length. Action granularity: Statements generally perform one action per line, with a conventional loop header. Reading flow: Consistent method formatting and grouping make scanning easy, but the poorly indented block in nodes() interrupts the otherwise natural flow.

Run 2

Code Structure: Clearly organized as a forwarding class with consistent override methods, except for an unrelated calculation in nodes(). Nesting: Almost entirely flat; nodes() introduces an unnecessary block and loop. Clarity of intent: Documentation, descriptive method names, and uniform delegation make the purpose obvious, but the unused runningTotal calculation is distracting and unexplained. Code length: Long but mostly justified by the interface's forwarding methods; the calculation adds unnecessary lines. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Predictable method formatting and grouped overloads support smooth scanning, while the poorly indented block in nodes() interrupts that consistency.

Run 3

Code Structure: Well-organized forwarding class with consistently grouped, small overrides; the unrelated calculation in nodes() disrupts this structure. Nesting: Almost entirely flat, except for an unnecessary block and loop in nodes(). Clarity of intent: Documentation, descriptive method names, and uniform delegation make the purpose clear, but the unused runningTotal calculation is unexplained and distracting. Code length: Numerous overrides are repetitive but appropriate for the forwarding interface; the calculation adds unnecessary lines. Action granularity: Statements generally perform one action per line, with a conventional loop header. Reading flow: Consistent formatting and predictable delegation make scanning easy, although the poorly indented block in nodes() interrupts the otherwise natural flow.