Sample

Schnappinger/argoUML/org.argouml.core.propertypanels.ui.UMLExpressionPanel

Human rating uses the original dataset scale.

Human3.93
Lines106

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
58.2Δ 3.4
Scalabrino0.6930–1; higher is more readable
36.6Δ 24.9
Dorn0.8240–1; higher is more readable
89.8Δ 28.2
Mi0.5910–1; higher is more readable
59.1Δ 2.5
LLOC24Logical lines; fewer is more readable
54.3Δ 7.3
DeepSeek V4 Pro17.670–20; mean of three runs
83.0Δ 21.5
GPT-6.1 Sol170–20; mean of three runs
55.3Δ 6.3
BTTF0.7060–1; higher is more readable
83.5Δ 21.9
Human3.931–4; original rating
61.6

Views

Source code

/* $Id: UMLExpressionPanel.java 19907 2012-12-30 13:06:01Z closettop_nightlybuild $ ***************************************************************************** * Copyright (c) 2009-2012 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * mvw * Thomas Neustupny ***************************************************************************** * * Some portions of this file was previously release using the BSD License: */ // Copyright (c) 2008-2009 The Regents of the University of California. All // Rights Reserved. Permission to use, copy, modify, and distribute this // software and its documentation without fee, and without a written // agreement is hereby granted, provided that the above copyright notice // and this paragraph appear in all copies. This software program and // documentation are copyrighted by The Regents of the University of // California. The software program and documentation are supplied "AS // IS", without any accompanying services from The Regents. The Regents // does not warrant that the operation of the program will be // uninterrupted or error-free. The end-user understands that the program // was developed for research purposes and is advised not to rely // exclusively on the program for any reason. IN NO EVENT SHALL THE // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. package org.argouml.core.propertypanels.ui; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.tigris.swidgets.LabelledLayout; /** * The panel that shows an Expression for an other UML element. * There are 8 kinds of Expressions defined in the UML 1.4.2. * * @author penyaskito */ class UMLExpressionPanel extends JPanel implements ChangeListener { private static final Logger LOG = Logger.getLogger(UMLExpressionPanel.class.getName()); private final UMLExpressionModel model; private final UMLExpressionLanguageField languageField; private final UMLExpressionBodyField bodyField; public UMLExpressionPanel(UMLExpressionModel model, String title) { super(new LabelledLayout()); LOG.log(Level.FINE, ">>New Expression panel created"); TitledBorder border = new TitledBorder(title); this.setBorder(border); this.model = model; this.languageField = new UMLExpressionLanguageField(model, false); this.bodyField = new UMLExpressionBodyField( model, true); boolean isReadOnly = !languageField.isEditable(); if (isReadOnly) { bodyField.setEditable(false); } else { add(languageField); } add(new JScrollPane(bodyField)); model.addChangeListener(this); } @Override public void removeNotify() { model.removeChangeListener(this); super.removeNotify(); } public void stateChanged(ChangeEvent e) { LOG.log(Level.FINE, ">>Values shown on panel are changed"); bodyField.update(); languageField.update(); } }

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.1861.236−61.421
Source linesThe number of non-empty source lines.106+42.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.5.2−7.8

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

Score0.693

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.107−2.752
Indentation frequencyHow rapidly indentation changes from line to line.65+1.511
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.105.893+1.07
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.037+0.583
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.81.439+0.51
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.82.953+0.152

Intercept 0.07 + feature contributions = 1.541 (log-odds).
Score = sigmoid(1.541) = 0.824.

Score0.591
Score24
Run 1

The code is well-structured: fields are clearly declared, the constructor is logically organized into setup steps, and methods are concise. Nesting is minimal—only one conditional block, which contains a single action per branch. Intent is clear from class and method names (UMLExpressionPanel, stateChanged, removeNotify). Code length is appropriate; there is no unnecessary verbosity. Most lines perform a single action, maintaining good action granularity. The reading flow is natural, with constructor steps in a logical order. Minor deductions: inconsistent indentation in removeNotify and stateChanged (tabs vs spaces) slightly disrupts visual flow, and the boolean flag in UMLExpressionBodyField(model, true) is less clear without context. Overall, the code is highly readable and maintainable.

Run 2

The code is highly readable due to its logical organization, clear naming conventions, and minimal nesting. The class has a focused purpose—building an expression panel—with fields, constructor, and overridden methods neatly ordered. Nesting is shallow; the only conditional (isReadOnly) contains a simple two-line if/else, which preserves clarity. Intent is unambiguous: class, method, and variable names accurately describe their roles, and the logger messages reinforce flow. Code length is concise without being overly terse; comments are limited to a useful class-level Javadoc and license header. Action granularity is mostly one logical step per line, though a few lines combine operations (e.g., `add(new JScrollPane(bodyField))`), slightly reducing granularity. Reading flow is natural: constructor initializes components, configures listeners, and confirms state changes. Minor deductions: the `stateChanged` method body could be indented consistently, and the `removeNotify` override lacks a Javadoc, but these are trivial. Overall, the code is clean, maintainable, and a strong example of readable Java UI code.

Run 3

The code is well-structured and readable. It has a clear class organization with logical field declarations, a straightforward constructor, and concise methods. Nesting is minimal—only one simple if/else block. The intent of each component (model, language field, body field, listener) is clear from naming and field types. Code length is appropriate for the class's responsibility. Most lines perform one action, contributing to a natural reading flow. Minor issues include inconsistent indentation in the stateChanged and removeNotify methods, where tabs and spaces are mixed. The extensive license header, while legally necessary, interrupts the initial reading flow before the package declaration. The constructor's conditional logic for read-only mode is reasonably clear but could be slightly more explicit by grouping setup steps. Overall, the code is maintainable and easy to follow.

Run 1

Code Structure: The class is logically organized into fields, constructor setup, lifecycle cleanup, and event handling. Nesting: Only one simple if/else keeps control flow easy to follow. Clarity of intent: Descriptive class, field, and method names make the expression panel's purpose clear, although boolean constructor arguments lack explanation. Code length: The implementation is concise; the lengthy license header adds scanning overhead without complicating the logic. Action granularity: Statements generally perform one action per line, with no compressed operations. Reading flow: Initialization proceeds naturally from layout and fields to editability, component placement, and listener registration. Mixed tabs and spaces, awkward line wrapping, and slightly unclear documentation reduce polish and readability.

Run 2

Code Structure: Fields, constructor, and lifecycle/event methods are logically organized with clear separation of responsibilities. Nesting: Only one shallow if/else block makes control flow easy to follow. Clarity of intent: Descriptive class, field, and method names convey the panel's purpose, although boolean constructor arguments lack explanation and the read-only language-field omission is not documented. Code length: Implementation is concise; the extensive license header adds scanning overhead but is not unnecessary implementation complexity. Action granularity: Each statement generally performs one action, with no crowded multi-statement lines. Reading flow: Initialization, component configuration, layout assembly, and listener registration follow a natural sequence. Inconsistent tabs/spaces and awkward line wrapping slightly disrupt visual consistency.

Run 3

Code Structure: The class is logically organized into fields, constructor initialization, lifecycle cleanup, and change handling. Nesting: Only one shallow if/else keeps control flow easy to follow. Clarity of intent: Descriptive class, field, and method names clearly convey an expression-editing panel, although boolean constructor arguments are unexplained. Code length: The implementation is concise, but extensive license comments dominate the file and a temporary border variable adds minor verbosity. Action granularity: Statements generally perform one action per line, with no compressed multi-statement lines. Reading flow: Initialization proceeds naturally from layout and fields to editability, component placement, and listener registration. Inconsistent tabs/spaces and awkward line wrapping slightly disrupt the otherwise straightforward presentation.