Sample

Schnappinger/jsweet/org.jsweet.transpiler.model.support.CompilationUnitElementSupport

Human rating uses the original dataset scale.

Human3.93
Lines49

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.9270–1; higher is more readable
87.6Δ 27.9
Scalabrino0.7710–1; higher is more readable
55.1Δ 4.6
Dorn0.5880–1; higher is more readable
66.7Δ 6.9
Mi0.5450–1; higher is more readable
40.9Δ 18.8
LLOC5Logical lines; fewer is more readable
83.0Δ 23.3
DeepSeek V4 Pro17.670–20; mean of three runs
83.0Δ 23.3
GPT-6.1 Sol190–20; mean of three runs
92.6Δ 32.8
BTTF0.670–1; higher is more readable
71.9Δ 12.2
Human3.931–4; original rating
59.7

Views

Source code

/* * JSweet transpiler - http://www.jsweet.org * Copyright (C) 2015 CINCHEO SAS <renaud.pawlak@cincheo.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jsweet.transpiler.model.support; import javax.lang.model.element.PackageElement; import org.jsweet.transpiler.model.CompilationUnitElement; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; /** * See {@link CompilationUnitElement}. * * @author Renaud Pawlak */ public class CompilationUnitElementSupport extends ExtendedElementSupport<JCCompilationUnit> implements CompilationUnitElement { public CompilationUnitElementSupport(JCCompilationUnit tree) { super(tree); } @Override public PackageElement getPackage() { return tree.packge; } @Override public String getSourceFilePath() { return tree.sourcefile.getName(); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.49+19.6
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.555.409−18.328
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.5.07−7.604

Intercept 8.87 + feature contributions = 2.537 (log-odds).
Score = sigmoid(2.537) = 0.927.

Score0.771

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.128−1.756
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.127.98+1.26
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.50−0.734
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.034+0.613
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.48.729+0.271
Indentation frequencyHow rapidly indentation changes from line to line.28+0.231

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

Score0.545
Score5
Run 1

The code is highly readable due to its clear structure and straightforward purpose. It uses a common pattern for support classes in Java, extending a base class and implementing an interface with minimal but clear method overrides. There is no unnecessary nesting or complexity, and each method performs a single, well-defined action. The license header and Javadoc provide context without obscuring the code. The imports are minimal and purposeful. Method names clearly express intent (getPackage, getSourceFilePath). The class is short and focused on its responsibility as a wrapper/support for compilation unit elements. Minor areas for improvement could include adding a brief comment explaining the underlying tree field access, but the code is self-explanatory for its intended audience.

Run 2

The code demonstrates excellent readability through clean structure and minimal complexity. The package declaration, imports, and class definition are logically organized. Nesting is virtually nonexistent, with all methods operating at a flat, single level. Intent is clear - this is a support class implementing a compilation unit element wrapper. The code is concise with no unnecessary boilerplate beyond standard license and documentation. Each method performs exactly one action: getPackage() returns the package, getSourceFilePath() returns the source path. Reading flow is natural, following Java conventions from package declaration through imports to class definition and methods. The class name, method names, and Javadoc comments clearly communicate purpose without ambiguity. Minor deductions only for the excessive license header and slight redundancy in the class/method documentation.

Run 3

The code is well-structured with a clear package declaration, imports, and class definition. It follows a flat hierarchy with no unnecessary nesting, making it easy to follow. The intent is unambiguous: a support class implementing CompilationUnitElement. The methods are concise, each performing a single action, and the reading flow is natural—moving from class declaration to constructor to overridden methods. Naming conventions are clear, and the comments provide useful context without being excessive. Minor deductions include the slightly redundant 'tree' field access in getSourceFilePath (could be 'tree.sourcefile.getName()' but this is trivial) and the empty line before the closing brace, which is a stylistic nitpick. Overall, the code is highly readable and maintainable.

Run 1

Code Structure: The class is logically organized, with imports, a constructor, and two focused accessor methods. Nesting: No nested control flow; all methods are flat and easy to scan. Clarity of intent: Descriptive class and method names clearly communicate the wrapper's purpose, though the internal field name 'packge' is less intuitive and documentation is minimal. Code length: The implementation is concise; the license header is standard boilerplate rather than unnecessary logic. Action granularity: Each statement performs a single action on its own line. Reading flow: Conventional Java ordering and consistent indentation make reading natural. The long class declaration and extra trailing blank lines are minor formatting distractions.

Run 2

Code Structure: A well-organized wrapper class with a constructor and two clearly separated accessor methods. Nesting: Minimal; methods contain only single statements. Clarity of intent: Descriptive class and method names, the implemented interface, and the documentation link make its purpose clear, although the underlying field name 'packge' is unusual. Code length: The implementation is concise without unnecessary logic; the lengthy license header is standard boilerplate. Action granularity: Each statement performs one action, keeping individual lines easy to understand. Reading flow: Package declaration, imports, documentation, constructor, and accessors follow a natural Java layout. Minor readability issues include the long class declaration and extra blank lines at the end.

Run 3

Code Structure: A logically organized class with a constructor and two clearly separated accessors. Nesting: Minimal; there are no nested control structures. Clarity of intent: Descriptive class and method names, interface implementation, and override annotations make its purpose clear, though the internal field name 'packge' is less intuitive. Code length: The implementation is concise, with only minor excess whitespace and a lengthy standard license header. Action granularity: Each statement performs a single action. Reading flow: Imports, documentation, declaration, constructor, and accessors follow a natural Java layout. The long class declaration slightly reduces scanability.