Sample

int-c1dca7170204-SRC

Unmodified source class

Lines93

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6140–1; higher is more readable
Dorn0.3810–1; higher is more readable
Mi0.5070–1; higher is more readable
LLOC35Logical lines; fewer is more readable
DeepSeek V4 Pro16.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.460–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 predecessorsOrEmpty(node).size() + successorsOrEmpty(node).size() - (edgeType == EdgeType.BOTH && predecessorsOrEmpty(node).contains(node) ? 1 : 0); } else { return graph.adjacentNodes(node).size(); } } @Override public boolean contains(@Nullable Object obj) { if (!(obj instanceof EndpointPair)) { return false; } EndpointPair<?> endpointPair = (EndpointPair<?>) obj; if (graph.isDirected() != endpointPair.isOrdered()) { return false; } if (graph.isDirected()) { Object source = endpointPair.source(); Object target = endpointPair.target(); return (node.equals(source) && successorsOrEmpty(node).contains(target)) || (node.equals(target) && predecessorsOrEmpty(node).contains(source)); } else { 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)); } } /** * 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 graph.predecessors(node); } else { return ImmutableSet.of(); } } /** * 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 graph.successors(node); } else { return ImmutableSet.of(); } } }

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.3171.581−104.662
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.805−7.207

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

Score0.614

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.856+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.989−0.401
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.109−0.12

Intercept 0.07 + feature contributions = -0.485 (log-odds).
Score = sigmoid(-0.485) = 0.381.

Score0.507
Score35
Run 1

The code is well-structured and readable. It has a clear class hierarchy, concise helper methods, and logical organization. Nesting is minimal, with early returns reducing complexity in contains(). Action granularity is good—each statement is simple and focused. Naming is clear (e.g., predecessorsOrEmpty, edgeType). Javadocs explain non-obvious behavior. Minor deductions: repeated calls to predecessorsOrEmpty(node) in size(), and contains() has slightly longer boolean logic. Overall, the code follows a consistent style and is easy to understand.

Run 2

The code is generally well-structured and readable. The class has a clear purpose with descriptive method names and a concise enum for edge types. The logic in size() and contains() is moderately complex but not deeply nested. The helper methods predecessorsOrEmpty and successorsOrEmpty improve intent clarity. However, readability is slightly reduced by the inline conditional expression in size() which combines multiple operations on one line, and by the repeated calls to predecessorsOrEmpty(node) within the same expression. The contains() method could be refactored to reduce branching, but it remains understandable. Overall, the code is clean, logical, and follows good practices.

Run 3

The code is generally well-structured and readable. It has a clear class purpose, sensible field naming, and a straightforward constructor. Methods are short and focused, with low nesting. Helper methods like `predecessorsOrEmpty` and `successorsOrEmpty` reduce duplication and clarify intent. The `size()` and `contains()` methods have a few conditionals but remain flat and logically ordered. However, readability is slightly reduced by the long ternary expression in `size()`, which combines subtraction and containment logic in one line. The `contains()` method also mixes type checking, directedness checks, and edge endpoint comparison, which could be broken into smaller private methods for better action granularity. Overall, the code is maintainable but a few denser expressions and conditionals prevent a higher score.

Run 1

Code Structure: The class is logically organized into fields, an enum, a constructor, public operations, and focused private helpers. Nesting: Shallow conditional branches and early validation returns keep complexity low. Clarity of intent: Descriptive names and documentation clearly explain edge filtering and membership checks; the self-loop adjustment in size() would benefit from a comment. Code length: Concise overall, with minor repetition in helper conditions and predecessor lookups. Action granularity: Statements generally perform one action each, although compound Boolean expressions and the size calculation require extra attention. Reading flow: Consistent formatting and distinct directed versus undirected branches support natural reading, with only the dense size expression slightly interrupting the flow.

Run 2

Code Structure: Fields, enum, constructor, overridden methods, and private helpers are logically organized. Nesting: Control flow is shallow, with guard clauses in contains() reducing complexity. Clarity of intent: Descriptive names, enum comments, and helper documentation explain edge filtering well; the self-loop correction in size() would benefit from a comment. Code length: Compact and appropriate, although repeated predecessorsOrEmpty(node) calls and explicit else branches add minor verbosity. Action granularity: Statements generally perform one action per line; compound return expressions remain readable but require some attention. Reading flow: Consistent formatting and clear directed-versus-undirected branches make the code easy to follow, with only the size calculation and compound membership checks slowing comprehension.

Run 3

Code Structure: Well-organized class with focused methods, an explicit edge-type enum, and reusable helpers. Nesting: Shallow conditionals and early validation returns keep complexity low. Clarity of intent: Descriptive names and helper documentation clearly convey incoming/outgoing edge filtering; the self-loop subtraction in size() would benefit from a comment. Code length: Concise overall, though repeated predecessor lookups and explicit else branches add minor verbosity. Action granularity: Statements generally perform one action each; compound return expressions remain manageable but require careful reading. Reading flow: Fields, constructor, public operations, and private helpers follow a natural order. Directed and undirected cases are clearly separated, although the size calculation and symmetric membership expressions slightly slow comprehension.