Sample

int-5f60be08a81f-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines35

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4490–1; higher is more readable
Dorn0.2450–1; higher is more readable
Mi0.0590–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.5010–1; higher is more readable

Views

Source code

package com.google.common.graph; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterators; import com.google.common.collect.UnmodifiableIterator; import java.util.AbstractSet; import java.util.Map; import org.jspecify.annotations.Nullable; /** * A class to represent the set of edges connecting an (implicit) origin node to a target node. * * <p>The {@link #nodeToOutEdge} map means this class only works on networks without parallel edges. * See {@link MultiEdgesConnecting} for a class that works with parallel edges. * * @author James Sexton * @param <E> Edge parameter type */ final class EdgesConnecting<E> extends AbstractSet<E> { private final Map<?, E> nodeToOutEdge; private final Object targetNode; EdgesConnecting(Map<?, E> nodeToEdgeMap, Object targetNode) { this.nodeToOutEdge = checkNotNull(nodeToEdgeMap); this.targetNode = checkNotNull(targetNode); } @Override public UnmodifiableIterator<E> iterator() { E connectingEdge = getConnectingEdge(); return (connectingEdge == null) ? ImmutableSet.<E>of().iterator() : Iterators.singletonIterator(connectingEdge); } @Override public int size() { return getConnectingEdge() == null ? 0 : 1; } @Override public boolean contains(@Nullable Object edge) { E connectingEdge = getConnectingEdge(); return connectingEdge != null && connectingEdge.equals(edge); } private @Nullable E getConnectingEdge() { return nodeToOutEdge.get(targetNode); } }

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.1511.099−49.866
Source linesThe number of non-empty source lines.35+14
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.831−7.246

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

Score0.449

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.152−2.773
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.152+1.648
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.36−0.238
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.27−0.199
Indentation frequencyHow rapidly indentation changes from line to line.27+0.197
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.087+0.093
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.34.791+0.076

Intercept 0.07 + feature contributions = -1.126 (log-odds).
Score = sigmoid(-1.126) = 0.245.

Score0.059
Score15
Run 1

The code has some positive aspects: the class purpose is documented with a clear Javadoc, and most methods are small and focused (good action granularity). However, readability is significantly hurt by formatting. Several unrelated statements are compressed onto single lines, especially in the imports and constructor, breaking the 'one action per line' principle. The inconsistent indentation and spacing make the code feel disorganized, reducing reading flow. The iterator() method uses a nested ternary, adding avoidable nesting and cognitive load. Method order is logical, but the cramped formatting obscures the structure. Overall, the code is functional but visually cluttered, requiring extra effort to parse, landing it in the lower-middle range of readability.

Run 2

The code is functional and mostly readable, but formatting and structural choices detract from clarity. The class has a clear purpose and single responsibility, and method names reflect their intent. The logic is flat with minimal nesting, which aids comprehension. However, the one-line class fields, constructor body, and method declarations create visual clutter and reduce readability. Several lines combine multiple actions, violating action granularity and disrupting natural reading flow. Imports are also compressed onto single lines, making them harder to scan. While the code is concise, it feels unnecessarily compact at the expense of consistency and readability. With standard formatting and spaced-out declarations, it would be significantly more readable.

Run 3

The code suffers from severe formatting issues that undermine readability. Multiple statements are crammed onto single lines (e.g., imports, field declarations, constructor body), violating the 'one action per line' principle. Opening braces are placed incorrectly in some methods, making the structure feel disjointed. The logic itself is simple and the class purpose is documented, but the poor layout obscures natural reading flow and makes the code appear tangled. Nesting is minimal, which is positive, and method names generally express intent. Overall, the code is functionally understandable but visually unpolished, requiring a reader to mentally reformat it.

Run 1

Code Structure: The class is logically organized into fields, a constructor, collection overrides, and a lookup helper, but compressed declarations and imports obscure those boundaries. Nesting: Minimal nesting and straightforward conditional expressions make the logic easy to follow. Clarity of intent: Descriptive names and class documentation clearly explain the single-edge constraint and lookup behavior. Code length: The implementation is appropriately concise without unnecessary logic, although excessive compression reduces readability. Action granularity: Multiple imports, field declarations, assignments, and statements share lines, making individual actions harder to scan. Reading flow: Method order is natural, but inconsistent line breaks, inline method bodies, and annotations attached to closing braces interrupt visual flow. Conventional formatting would substantially improve readability without changing the design.

Run 2

Code Structure: The class is logically organized around fields, construction, set operations, and a lookup helper, but compressed formatting obscures these boundaries. Nesting: Minimal nesting and simple conditional expressions make the logic easy to follow. Clarity of intent: Descriptive names and class documentation clearly explain the purpose and restriction against parallel edges. Code length: The implementation is appropriately concise without unnecessary logic. Action granularity: Multiple imports, field declarations, assignments, and statements share lines, reducing readability. Reading flow: Inconsistent brace placement and annotations attached to preceding closing braces interrupt otherwise natural method ordering. Conventional formatting would significantly improve readability.

Run 3

Code Structure: A logically organized class separates construction, iteration, size, membership, and lookup, but cramped formatting obscures these boundaries. Nesting: Very shallow; simple conditional expressions avoid nested control flow. Clarity of intent: Descriptive names and class documentation clearly explain the single-edge set and its restriction against parallel edges. Code length: Concise, with little unnecessary code and a useful shared lookup helper. Action granularity: Multiple imports, field declarations, assignments, and statements share lines, making individual actions harder to scan. Reading flow: Conventional method ordering supports understanding, but inconsistent brace placement, inline method bodies, and annotations attached to closing braces disrupt the flow. Overall, straightforward logic and clear naming are weakened primarily by formatting.