Sample

int-c144d93d1385-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines93

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.590–1; higher is more readable
Dorn0.3570–1; higher is more readable
Mi0.4720–1; higher is more readable
LLOC35Logical lines; fewer is more readable
DeepSeek V4 Pro90–20; mean of three runs
GPT-6.1 Sol120–20; mean of three runs
BTTF0.4280–1; higher is more readable

Views

Source code

package com.google.common.graph; import com.google.common.collect.ImmutableSet; import java.util.AbstractSet; import java.util.Set; import org.jspecify.annotations.Nullable; /** * Abstract base class for an incident edges set that allows different implementations of {@link * AbstractSet#iterator()}. */ abstract class IncidentEdgeSet<N> extends AbstractSet<EndpointPair<N>> { final N node; final ArchetypeGraph<N> graph; final EdgeType edgeType; enum EdgeType { INCOMING, // incoming incident edges only OUTGOING, // outgoing incident edges only BOTH // both incoming and outgoing incident edges } IncidentEdgeSet(ArchetypeGraph<N> graph, N node, EdgeType edgeType) { this.graph = graph; this.node = node; this.edgeType = edgeType; } @Override public boolean remove(@Nullable Object o) { throw new UnsupportedOperationException(); } @Override public int size() { if (!((graph.isDirected()))) { return graph.adjacentNodes(node).size(); } else { return predecessorsOrEmpty(node).size() + successorsOrEmpty(node).size() - (edgeType == EdgeType.BOTH && predecessorsOrEmpty(node).contains(node) ? 1 : 0); } } @Override public boolean contains(@Nullable Object obj) { if (!((!(obj instanceof EndpointPair)))) {} else { return false; } EndpointPair<?> endpointPair = (EndpointPair<?>) obj; if (!((graph.isDirected() != endpointPair.isOrdered()))) {} else { return false; } if (!((graph.isDirected()))) { Set<N> adjacent = graph.adjacentNodes(node); Object nodeU = endpointPair.nodeU(); Object nodeV = endpointPair.nodeV(); return (node.equals(nodeV) && adjacent.contains(nodeU)) || (node.equals(nodeU) && adjacent.contains(nodeV)); } else { Object source = endpointPair.source(); Object target = endpointPair.target(); return (node.equals(source) && successorsOrEmpty(node).contains(target)) || (node.equals(target) && predecessorsOrEmpty(node).contains(source)); } } /** * Returns the predecessors of the given node, or an empty set if this set does not represent * incoming edges. */ private Set<N> predecessorsOrEmpty(N node) { if (!((edgeType == EdgeType.INCOMING || edgeType == EdgeType.BOTH))) { return ImmutableSet.of(); } else { return graph.predecessors(node); } } /** * Returns the successors of the given node, or an empty set if this set does not represent * outgoing edges. */ private Set<N> successorsOrEmpty(N node) { if (!((edgeType == EdgeType.OUTGOING || edgeType == EdgeType.BOTH))) { return ImmutableSet.of(); } else { return graph.successors(node); } } }

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.3404.12−112.336
Source linesThe number of non-empty source lines.93+37.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.819−7.229

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

Score0.59

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.94−2.292
Indentation frequencyHow rapidly indentation changes from line to line.81+2.065
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.81−1.438
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.92.845+0.888
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.95.894+0.743
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.95.968−0.4
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.12−0.224

Intercept 0.07 + feature contributions = -0.588 (log-odds).
Score = sigmoid(-0.588) = 0.357.

Score0.472
Score35
Run 1

The code structure is acceptable, but readability is severely hampered by confusing control flow and unnatural boolean expressions. Many conditionals use double negatives and empty if-blocks, e.g., `if (!((!(obj instanceof EndpointPair)))) {} else { ... }`, which obscures intent and disrupts reading flow. The `size()` method has a complex multi-line expression that is hard to parse. Nesting is moderate but combined with awkward logic becomes difficult to follow. While methods like `predecessorsOrEmpty` are clear, the overall clarity of intent is low due to inconsistent and convoluted checks. Action granularity is generally one action per line, but some lines are unnecessarily complex. Code length is reasonable, but the unnatural condition ordering and redundant parentheses make it feel longer. Overall, the code works but reads poorly.

Run 2

The code has reasonable class structure and naming but suffers from several readability issues. The most severe problem is the inverted boolean conditions with empty bodies and double negations, such as `if (!((graph.isDirected())))` and `if (!((!(obj instanceof EndpointPair)))) {} else { return false; }`. These make the intent confusing and the control flow harder to follow than necessary. The `contains` method is particularly tangled, mixing instanceof checks and boolean comparisons inside double negatives. The `size` method has moderate nesting with a conditional expression that is somewhat compact but acceptable. Helper methods like `predecessorsOrEmpty` and `successorsOrEmpty` are clear, but the surrounding braces and negations reduce overall clarity. The enum and field organization are fine, but the style choices force readers to mentally invert conditions repeatedly.

Run 3

The code has clear naming, a logical class structure, and good documentation. However, readability is hurt by awkward inverted conditionals like `if (!((graph.isDirected())))` and `if (!((!(obj instanceof EndpointPair)))) {} else { ... }` with empty blocks, which obscure intent. Nesting is generally shallow, but boolean expressions in `contains()` and `size()` are dense and hard to parse. The `size()` method mixes several concerns in one arithmetic expression. Methods mostly perform one action per line, but some lines pack multiple conditions. The required JSON output is provided.

Run 1

Code Structure: Fields, enum, constructor, overrides, and focused helper methods are logically organized. Nesting: Depth is shallow, but unnecessary else blocks and empty if branches complicate otherwise simple control flow. Clarity of intent: Descriptive names and documentation explain the graph operations, while repeated negations and excessive parentheses obscure conditions, especially the type and ordering checks in contains(). Code length: Generally compact, though redundant branching adds avoidable noise. Action granularity: Most statements perform one action; the size calculation combines degree counts and self-loop correction into a dense expression. Reading flow: Method organization is natural, but inverted guards with empty bodies interrupt comprehension and require mentally simplifying Boolean expressions. Straightforward early returns and simpler conditions would substantially improve readability.

Run 2

Code Structure: Fields, enum, constructor, overrides, and helper methods are logically organized. Nesting: Depth is shallow, but empty if blocks and unnecessary else branches complicate otherwise simple guards. Clarity of intent: Descriptive names and documentation explain the graph operations, while repeated negations and excessive parentheses obscure conditions. Code length: Generally compact, though redundant branching and repeated predecessor lookups add avoidable complexity. Action granularity: Most statements perform one action; compound return expressions are cohesive but require careful reading, especially the self-loop adjustment in size(). Reading flow: Method ordering is natural, but inverted conditions and empty branches interrupt comprehension and force readers to mentally simplify boolean expressions.

Run 3

Code Structure: The class is logically organized into fields, an enum, and focused methods, with helper methods separating edge-direction logic. Nesting: Depth is low, but unnecessary else branches and empty if blocks complicate control flow. Clarity of intent: Descriptive names and documentation help, while repeated negations and excessive parentheses obscure otherwise straightforward conditions. The self-loop adjustment in size() requires careful interpretation. Code length: Reasonably compact overall, though redundant conditional syntax adds avoidable verbosity. Action granularity: Most statements perform one action; compound boolean expressions remain manageable, but the empty if/else constructs on single lines are awkward. Reading flow: Method ordering and consistent formatting support navigation, but inverted checks, empty branches, and repeated helper calls interrupt natural reading.