Sample

int-ef8341ddc189-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines51

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5870–1; higher is more readable
Dorn0.5220–1; higher is more readable
Mi0.5180–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.3410–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 ? 0x0 : 0x1; } @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.1528.654−50.446
Source linesThe number of non-empty source lines.51+20.4
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.83−7.245

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

Score0.587

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.99.808+0.806
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.52−0.805
Indentation frequencyHow rapidly indentation changes from line to line.43+0.75
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.962−0.569
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.43−0.566
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.50.772+0.3
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.086+0.102

Intercept 0.07 + feature contributions = 0.089 (log-odds).
Score = sigmoid(0.089) = 0.522.

Score0.518
Score15
Run 1

The code is highly readable with clear structure: a focused class with a single responsibility, well-named fields and methods, and logical organization. Nesting is minimal—only one shallow conditional in iterator(). Intent is obvious from naming conventions (nodeToOutEdge, targetNode, getConnectingEdge) and Javadoc documentation. Code length is appropriate and concise, avoiding unnecessary boilerplate. Action granularity is excellent, with one primary operation per line and clean separation of concerns. Reading flow follows a natural top-down progression from fields to constructor to overridden methods, then private helper. Minor deductions only for the slightly cryptic hex notation (0x0/0x1 instead of 0/1) and the repeated getConnectingEdge() calls, which are trivial trade-offs for clarity.

Run 2

The code is well-structured with clear purpose and minimal complexity. The class is focused, methods are concise, and naming is descriptive. Nesting is flat, with only minor conditional expressions. Action granularity is appropriate, and the reading flow is natural. Minor deductions include the use of hexadecimal literals (0x0, 0x1) which slightly obscure intent, and the iterator method could be marginally clearer by avoiding the ternary chain. Overall, the code is highly readable and maintainable.

Run 3

The code is well-structured with a clear class purpose documented in Javadoc. Methods are short, focused, and follow a logical organization. Nesting is minimal—only a couple of ternary expressions and one conditional in contains(). Intent is clear: retrieve the single connecting edge for a target node. Action granularity is good, with one primary action per line. The reading flow is natural, moving from constructor to standard collection methods to the private helper. Minor drawbacks: the ternary in iterator() spans multiple lines but remains readable, and the size() method uses hex literals (0x0, 0x1) which is unconventional and slightly reduces clarity. Nullness annotations add helpful context. Overall, the code is concise, maintainable, and readable, with only trivial style quirks preventing a perfect score.

Run 1

Code Structure: Well-organized class with focused fields, constructor, standard set operations, and a shared lookup helper. Nesting: Essentially flat; conditional expressions are simple and easy to follow. Clarity of intent: Descriptive names and class documentation clearly explain the purpose and restriction against parallel edges. Hexadecimal 0x0 and 0x1 in size() unnecessarily obscure ordinary counts. Code length: Concise, with minimal duplication and no unnecessary logic. Action granularity: Statements generally perform one clear action, while compact boolean and conditional expressions remain readable. Reading flow: Natural progression from state initialization to public operations and the private helper; missing spacing between the package declaration and imports slightly reduces visual organization.

Run 2

Code Structure: Fields, constructor, set operations, and a private lookup helper are logically organized. Nesting: Methods are flat, with simple conditional expressions and no nested blocks. Clarity of intent: Descriptive names and class documentation clearly explain the single-edge set abstraction and its restriction against parallel edges. The hexadecimal literals 0x0 and 0x1 unnecessarily obscure ordinary size values. Code length: The implementation is concise, with short methods and minimal duplication. Action granularity: Each statement performs a focused operation; conditional expressions remain simple enough to read easily. Reading flow: The progression from initialization through public operations to the helper is natural, although tightly packed imports and the multiline iterator ternary introduce minor visual friction.

Run 3

Code Structure: Fields, constructor, overridden set methods, and a lookup helper are logically organized. Nesting: There is no deep nesting; simple conditional expressions keep control flow flat. Clarity of intent: Descriptive names and class documentation clearly explain the single-edge set and its restriction against parallel edges. However, hexadecimal literals 0x0 and 0x1 obscure ordinary size values slightly. Code length: The implementation is concise, with a small helper avoiding repeated lookup details. Action granularity: Statements generally perform one action per line; the iterator's conditional expression remains easy to follow. Reading flow: The class progresses naturally from initialization to public behavior and then implementation details. Minor drawbacks include tightly packed imports and the unnecessary hexadecimal notation.