Sample

Schnappinger/argoUML/org.argouml.uml.reveng.ui.ImportStatusScreen

Human rating uses the original dataset scale.

Human3.96
Lines281

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
26.1Δ 51.0
Scalabrino0.8250–1; higher is more readable
68.8Δ 8.2
Dorn0.0380–1; higher is more readable
26.7Δ 50.3
Mi0.560–1; higher is more readable
45.5Δ 31.5
LLOC102Logical lines; fewer is more readable
24.6Δ 52.5
DeepSeek V4 Pro13.670–20; mean of three runs
26.9Δ 50.2
GPT-6.1 Sol150–20; mean of three runs
25.7Δ 51.3
BTTF0.4280–1; higher is more readable
37.0Δ 40.1
Human3.961–4; original rating
77.1

Views

Source code

/* $Id: ImportStatusScreen.java 17871 2010-01-12 20:49:55Z linus $ ***************************************************************************** * Copyright (c) 2009 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: * tfmorris ***************************************************************************** * * 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.uml.reveng.ui; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import org.argouml.i18n.Translator; import org.argouml.taskmgmt.ProgressEvent; import org.argouml.taskmgmt.ProgressMonitor; /** * A window that shows the progress bar and a cancel button. As a convenience to * callers which may be executing on a thread other than the Swing event thread, * all methods use SwingUtilities.invokeLater() or * SwingUtilities.invokeAndWait() to make sure that Swing calls happen on the * appropriate thread. *<p> * TODO: React on the close button as if the Cancel button was pressed. */ public class ImportStatusScreen extends JDialog implements ProgressMonitor, WindowListener { private JButton cancelButton; private JLabel progressLabel; private JProgressBar progress; private JTextArea messageArea; private boolean hasMessages = false; private boolean canceled = false; /** * The constructor. * * @param title * @param iconName */ public ImportStatusScreen(Frame frame, String title, String iconName) { super(frame, true); if (title != null) { setTitle(title); } Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize(); getContentPane().setLayout(new BorderLayout(4, 4)); Container panel = new JPanel(new GridBagLayout()); // Parsing file x of z. progressLabel = new JLabel(); progressLabel.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.gridheight = 1; gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.1; panel.add(progressLabel, gbc); gbc.gridy++; // progress bar progress = new JProgressBar(); gbc.anchor = GridBagConstraints.CENTER; panel.add(progress, gbc); gbc.gridy++; panel.add( new JLabel(Translator.localize("label.import-messages")), gbc); gbc.gridy++; // Error/warning messageArea messageArea = new JTextArea(10, 50); gbc.weighty = 0.8; // gbc.gridheight = 10; gbc.fill = GridBagConstraints.BOTH; panel.add(new JScrollPane(messageArea), gbc); gbc.gridy++; // cancel/close button cancelButton = new JButton(Translator.localize("button.cancel")); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.SOUTH; gbc.weighty = 0.1; gbc.gridheight = GridBagConstraints.REMAINDER; panel.add(cancelButton, gbc); gbc.gridy++; cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (isComplete()) { close(); } canceled = true; } }); getContentPane().add(panel); pack(); Dimension contentPaneSize = getContentPane().getPreferredSize(); setLocation(scrSize.width / 2 - contentPaneSize.width / 2, scrSize.height / 2 - contentPaneSize.height / 2); setResizable(true); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(this); } public void setMaximumProgress(final int i) { SwingUtilities.invokeLater(new Runnable () { public void run() { progress.setMaximum(i); setVisible(true); } }); } public void updateProgress(final int i) { SwingUtilities.invokeLater(new Runnable () { public void run() { progress.setValue(i); if (isComplete()) { if (hasMessages) { cancelButton.setText( Translator.localize("button.close")); } else { close(); } } } }); } private boolean isComplete() { return progress.getValue() == progress.getMaximum(); } /** * The UID. */ private static final long serialVersionUID = -1336242911879462274L; /* * @see org.argouml.application.api.ProgressMonitor#close() */ public void close() { SwingUtilities.invokeLater(new Runnable () { public void run() { setVisible(false); dispose(); } }); } /* * @see org.argouml.application.api.ProgressMonitor#isCanceled() */ public boolean isCanceled() { return canceled; } /* * @see org.argouml.application.api.ProgressMonitor#notifyMessage(java.lang.String, java.lang.String, java.lang.String) */ public void notifyMessage(final String title, final String introduction, final String message) { hasMessages = true; // TODO: Add filename ? messageArea.setText(messageArea.getText() + title + "\n" + introduction + "\n" + message + "\n\n"); messageArea.setCaretPosition(messageArea.getText().length()); } /* * @see org.argouml.application.api.ProgressMonitor#notifyNullAction() */ public void notifyNullAction() { String msg = Translator.localize("label.import.empty"); notifyMessage(msg, msg, msg); } /* * @see org.argouml.application.api.ProgressMonitor#updateMainTask(java.lang.String) */ public void updateMainTask(final String name) { SwingUtilities.invokeLater(new Runnable () { public void run() { setTitle(name); } }); } /* * @see org.argouml.application.api.ProgressMonitor#updateSubTask(java.lang.String) */ public void updateSubTask(final String action) { SwingUtilities.invokeLater(new Runnable () { public void run() { progressLabel.setText(action); } }); } /* * @see org.argouml.persistence.ProgressListener#progress(org.argouml.persistence.ProgressEvent) */ public void progress(ProgressEvent event) throws InterruptedException { // ignored } public void windowClosing(WindowEvent e) { // User closing the progress window is interpreted as cancel request canceled = true; close(); } public void windowActivated(WindowEvent e) { } public void windowClosed(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } }

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.7905.735−260.889
Source linesThe number of non-empty source lines.281+112.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.891−7.337

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

Score0.825

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.282−8.948
Indentation frequencyHow rapidly indentation changes from line to line.209+6.492
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.209−4.375
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.280.952+3.517
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.122.989−1.544
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.122.979+1.18
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.059+0.368

Intercept 0.07 + feature contributions = -3.241 (log-odds).
Score = sigmoid(-3.241) = 0.038.

Score0.56
Score102
Run 1

The code has a clear, logical class structure and reasonably flat nesting, with method names indicating intent. However, it suffers from verbose Swing layout code, redundant threading wrappers, and inconsistent formatting. The constructor is long and mixes multiple concerns. Some logic (e.g., isComplete checking progress values) is fragile. Action granularity is mostly one per line, but notification message concatenation is cramped. Reading flow is impaired by scattered comments, unused parameters, and dead code. Overall, it is maintainable but not highly readable.

Run 2

The code is moderately readable. It has clear structure with separated UI setup, action listeners, and method implementations. However, several issues reduce readability: the constructor is quite long with many GridBagConstraints manipulations, which is inherently difficult to follow. There are commented-out lines that add noise. Some methods like notifyMessage concatenate strings without spacing, making intent less clear. Threading via SwingUtilities.invokeLater adds nesting. WindowListener methods are empty (noise) and could be handled differently. The double license header is excessive and distracting. Variable naming is generally clear, but the empty interface implementations and boolean flag toggling ('hasMessages') obscure control flow. Reading flow is logical but interrupted by boilerplate. The code would benefit from extracting UI setup into helper methods and cleaning up comments.

Run 3

The code has reasonable structure with clear separation of UI components and methods, but suffers from several readability issues. The constructor is long and mixes layout logic with component setup, making it harder to follow. GridBagConstraints setup is verbose and repetitive, with commented-out code adding noise. The nesting level is moderate but acceptable. Intent is generally clear through method names like 'updateProgress' and 'notifyMessage', though the class name 'ImportStatusScreen' could be more specific about its dual progress/dialog role. Action granularity is mostly good, but some lines like the messageArea.setText concatenation are unnecessarily dense. The reading flow is disrupted by excessive copyright headers (over 40 lines), unused WindowListener methods, and a serialVersionUID placed mid-class. The code follows Java conventions but would benefit from extracting layout setup into helper methods, removing dead code, and reducing header noise.

Run 1

Code Structure: Clearly scoped class with separate progress, messaging, cancellation, and window-handling methods, but the constructor combines extensive layout setup and event wiring. Nesting: Generally shallow; anonymous Runnable classes and nested completion checks add moderate depth. Clarity of intent: Descriptive method and field names explain most behavior, though generic parameters, an unused iconName, stale TODOs, and a threading guarantee contradicted by notifyMessage reduce clarity. Code length: Swing boilerplate, repeated invokeLater wrappers, empty listener methods, and redundant comments make the class longer than necessary. Action granularity: Most statements perform one action, with layout assignments easy to inspect individually. Reading flow: Initialization proceeds naturally from labels to progress bar, messages, and buttons, followed by operational methods. However, mutable layout constraints, the mid-class serialVersionUID declaration, commented-out code, and repetitive documentation interrupt the flow.

Run 2

Code Structure: Cohesive dialog class with clearly separated progress, messaging, and window-handling methods, though the constructor mixes layout setup and event behavior. Nesting: Mostly shallow; anonymous Runnable classes and nested completion checks add moderate indentation. Clarity of intent: Descriptive method and field names make the purpose clear, but generic variables, an unused iconName parameter, and documentation contradicting actual threading and close behavior reduce clarity. Code length: Verbose Swing setup and repeated invokeLater wrappers increase length; commented-out code and stale comments add noise. Action granularity: Generally one operation per line, with compact empty callbacks as minor exceptions. Reading flow: UI construction follows a natural sequence, and short methods are easy to scan, but repeated boilerplate and the serialVersionUID declaration among methods interrupt the flow.

Run 3

Code Structure: Fields and focused methods are logically organized, but the constructor mixes layout, event handling, and window configuration. Nesting: Mostly shallow; anonymous Runnable classes and nested completion checks add moderate depth. Clarity of intent: Descriptive names and familiar Swing patterns communicate purpose, though generic parameters, an unused iconName, and documentation inconsistent with actual thread handling reduce clarity. Code length: Repeated invokeLater wrappers, verbose layout setup, and boilerplate listeners make the class longer than necessary. Action granularity: Statements generally perform one action per line, with readable separation between UI setup steps. Reading flow: Construction proceeds naturally into progress updates and lifecycle methods, but stale TODOs, commented-out code, and inconsistent documentation interrupt the flow.