Sample

Schnappinger/jsweet/def.dom.MouseEvent

Human rating uses the original dataset scale.

Human4
Lines35

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
47.8Δ 43.3
Scalabrino0.5570–1; higher is more readable
15.1Δ 76.0
Dorn00–1; higher is more readable
3.0Δ 88.1
Mi00–1; higher is more readable
0.3Δ 90.8
LLOC30Logical lines; fewer is more readable
49.2Δ 41.9
DeepSeek V4 Pro14.670–20; mean of three runs
34.8Δ 56.3
GPT-6.1 Sol160–20; mean of three runs
38.9Δ 52.1
BTTF0.3120–1; higher is more readable
22.1Δ 69.0
Human41–4; original rating
91.1

Views

Source code

package def.dom; public class MouseEvent extends UIEvent { public java.lang.Boolean altKey; public int button; public int buttons; public double clientX; public double clientY; public java.lang.Boolean ctrlKey; public Element fromElement; public double layerX; public double layerY; public java.lang.Boolean metaKey; public double movementX; public double movementY; public double offsetX; public double offsetY; public double pageX; public double pageY; public EventTarget relatedTarget; public double screenX; public double screenY; public java.lang.Boolean shiftKey; public Element toElement; public int which; public double x; public double y; native public java.lang.Boolean getModifierState(java.lang.String keyArg); native public void initMouseEvent(java.lang.String typeArg, java.lang.Boolean canBubbleArg, java.lang.Boolean cancelableArg, Window viewArg, double detailArg, double screenXArg, double screenYArg, double clientXArg, double clientYArg, java.lang.Boolean ctrlKeyArg, java.lang.Boolean altKeyArg, java.lang.Boolean shiftKeyArg, java.lang.Boolean metaKeyArg, double buttonArg, EventTarget relatedTargetArg); public static MouseEvent prototype; public MouseEvent(java.lang.String typeArg, MouseEventInit eventInitDict){} public MouseEvent(java.lang.String typeArg){} protected MouseEvent(){} }

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.1596.975−52.7
Source linesThe number of non-empty source lines.35+14
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.647−6.97

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

Score0.557

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.406.972−13.573
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.1−0.703
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.066+0.303
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.36−0.238
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.34.821+0.077

Intercept 0.07 + feature contributions = -14.47 (log-odds).
Score = sigmoid(-14.47) = 0.

Score0
Score30
Run 1

The code has a clear, logical structure as a domain model class, listing many related properties and methods. However, readability is significantly harmed by extremely long method signatures—especially the initMouseEvent method—that cram multiple parameters onto a single line, making it difficult to visually parse. Action granularity suffers because multiple parameters share one line rather than one per line, and the reading flow is disrupted by the long parameter list. Nesting is flat and clarity of intent is decent, but the use of fully qualified java.lang.Boolean and java.lang.String types adds unnecessary verbosity. Overall, the organization is predictable and straightforward, but formatting and verbosity prevent it from being highly readable.

Run 2

The code has a clear, logical structure: all fields grouped together, followed by methods and constructors, making it easy to scan. It is flat with no nesting, which aids readability. Naming is explicit and follows typical DOM API conventions, so intent is clear for developers familiar with the domain. However, readability is reduced by very long method signatures (e.g., initMouseEvent) that contain many parameters, making them hard to parse quickly. Action granularity is generally one field or method per line, which is good. The reading flow is natural from fields to methods, but the excessively verbose fully qualified names like java.lang.Boolean add noise. Some redundancy (e.g., multiple constructors with empty bodies) could be simplified, but overall the code is fairly readable but suffers from dense parameter lists.

Run 3

The code is a straightforward DOM type declaration with excellent structure: fields are grouped logically and ordered by type, with a single field per line. Nesting is minimal (class-level only), and clarity of intent is high—each field and method maps clearly to the MouseEvent specification. The two long method signatures (getModifierState and initMouseEvent) slightly reduce readability due to their horizontal length, but this is common in API bindings. Action granularity is appropriate, and reading flow is natural, though the constructor overloads at the bottom could be grouped more explicitly with comments. Overall, highly readable for a generated or boilerplate DOM class.

Run 1

Code Structure: A straightforward event-binding class, with fields followed by methods and constructors; the prototype field slightly interrupts this organization. Nesting: Flat, with no nested logic. Clarity of intent: Familiar mouse-event property names and inheritance make the purpose clear, though overlapping coordinates and legacy fields lack explanations. Code length: Concise overall, but fully qualified types add visual noise, and initMouseEvent has an excessively long signature. Action granularity: Each declaration occupies its own line, making individual members easy to identify. Reading flow: Consistent declarations support scanning, but missing blank lines between member groups, unconventional modifier ordering, and tightly formatted empty constructors reduce readability.

Run 2

Code Structure: A straightforward class declaration separates fields, methods, and constructors, although the static prototype field interrupts this grouping. Nesting: Flat, with no nested control flow. Clarity of intent: The class name, inheritance, and conventional event-property names make its purpose clear; native declarations and empty constructors suggest an API binding, but this is not documented. Code length: Concise overall, though fully qualified java.lang types add visual noise and initMouseEvent has an excessively long signature. Action granularity: Each field, method, and constructor occupies its own line, making declarations easy to scan. Reading flow: Generally predictable, but minimal spacing, limited semantic grouping of related properties, and the unwrapped parameter list reduce readability.

Run 3

Code Structure: A straightforward class declaration separates fields, methods, and constructors, though spacing and semantic field grouping would improve organization. Nesting: Essentially flat, with no nested control flow. Clarity of intent: The class name, inheritance, and familiar mouse-event properties clearly identify its purpose; native methods and empty constructors lack explanatory context. Code length: Concise overall, but initMouseEvent has an excessively long signature that would benefit from wrapping. Action granularity: Each field, method, and constructor occupies its own line, making individual declarations easy to scan. Reading flow: Generally natural from properties to methods to constructors, but the prototype field interrupts that progression, and fully qualified types add visual noise.