Sample

int-8ea80a272f90-SRC

Unmodified source class

Lines51

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6050–1; higher is more readable
Dorn0.5210–1; higher is more readable
Mi0.5180–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.6240–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.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.818−7.228

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

Score0.605

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.981−0.57
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.762+0.3
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.087+0.1

Intercept 0.07 + feature contributions = 0.086 (log-odds).
Score = sigmoid(0.086) = 0.521.

Score0.518
Score15
Run 1

The code is well-structured and adheres to clean code principles. It has a clear purpose, documented by a concise Javadoc comment. The class is small and focused, with shallow nesting and no unnecessary complexity. Each method performs a single, clear action, and method names effectively communicate intent. The use of helper methods like getConnectingEdge reduces duplication and improves readability. Null handling is consistent, and the iterator logic is straightforward. Minor deductions: the ternary expressions are slightly dense and could be replaced with if-else for even greater clarity, and the class-level Javadoc assumes some internal knowledge. Overall, the code is highly readable and maintainable.

Run 2

The code is highly readable with a clear logical structure: class definition, field declarations, constructor, then overridden methods in a natural order. Nesting is minimal, with simple ternary expressions in iterator() and size() methods. Intent is well-documented through Javadoc explaining the class purpose and its limitations. The code is concise, with each method performing a single clear action. Action granularity is appropriate—one main operation per line with minor condensing in ternary returns. Reading flow follows standard Java conventions: constructor initializes immutable state, methods are ordered logically (iterator, size, contains), and the private helper getConnectingEdge() is placed last. The use of descriptive names like nodeToOutEdge and getConnectingEdge makes the code self-documenting. Minor deductions for the slightly dense ternary expressions that could be if-else blocks for even greater clarity.

Run 3

The code is highly readable. Structure is logical, with clear separation of methods and a focused class responsibility. Nesting is minimal — no deep blocks, and helper method getConnectingEdge() consolidates repeated lookup logic. Intent is explicit through meaningful names (nodeToOutEdge, targetNode, connectingEdge) and clear Javadoc. Code length is concise, though slightly redundant in the iterator method due to type-qualified ImmutableSet call. Action granularity is largely one action per line, especially in simple methods and ternary expressions. Reading flow is natural — constructor, then standard overridden methods, followed by a private helper. Minor deductions: the iterator method’s conditional expression spans multiple lines and could be slightly simplified; the contains method repeats the lookup pattern instead of using a local variable. Overall, this is a well-structured, clean implementation that would be easy for most developers to understand and maintain.

Run 1

Code Structure: Clearly organized around two fields, a constructor, standard set operations, and a shared lookup helper. Nesting: Essentially flat, with simple conditional expressions and no nested control flow. Clarity of intent: Descriptive names, documentation explaining the no-parallel-edges constraint, and nullable annotations make behavior clear. Code length: Concise without unnecessary duplication; the helper centralizes edge lookup. Action granularity: Each statement performs a focused action, although the iterator's ternary combines selection and iterator creation. Reading flow: Natural progression from initialization to public operations and the private helper. Minor readability costs come from the multiline ternary and generic empty-set syntax, but neither significantly obscures the implementation.

Run 2

Code Structure: Fields, constructor, set-operation overrides, and a private lookup helper are logically organized. Nesting: Methods are flat, with simple conditional expressions and no nested control flow. Clarity of intent: Descriptive names and class documentation clearly explain the single-edge model and its restriction against parallel edges. Code length: The implementation is concise, with the shared lookup extracted into a small helper. Action granularity: Statements generally perform one action per line; conditional expressions compactly express straightforward choices. Reading flow: The progression from initialization to public operations to the lookup helper is natural. Minor readability drawbacks include tightly packed imports and the multiline generic ternary in iterator(), which requires slightly more attention than the other methods.

Run 3

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 relationship and restriction against parallel edges. Code length: The implementation is concise without sacrificing meaning; the shared lookup helper avoids repetition. Action granularity: Each statement performs one clear operation, with only straightforward expressions combining checks and results. Reading flow: Consistent formatting and familiar collection overrides make the code easy to follow. Minor readability costs include the multiline ternary in iterator(), explicit generic syntax, and the slightly inconsistent nodeToEdgeMap versus nodeToOutEdge naming.