Sample

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

Human rating uses the original dataset scale.

Human3.91
Lines176

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
38.8Δ 16.0
Scalabrino0.7360–1; higher is more readable
45.2Δ 9.6
Dorn0.2150–1; higher is more readable
42.2Δ 12.5
Mi0.5890–1; higher is more readable
57.8Δ 3.0
LLOC42Logical lines; fewer is more readable
42.1Δ 12.7
DeepSeek V4 Pro15.330–20; mean of three runs
41.3Δ 13.5
GPT-6.1 Sol150–20; mean of three runs
25.7Δ 29.0
BTTF0.3810–1; higher is more readable
32.7Δ 22.1
Human3.911–4; original rating
54.8

Views

Source code

/* $Id: UMLSignalComboBoxModel.java 19906 2012-12-28 18:30:46Z linus $ ***************************************************************************** * Copyright (c) 2009-2010 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: * Bob Tarling ***************************************************************************** * * Some portions of this file was previously release using the BSD License: */ // Copyright (c) 1996-2006 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.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.swing.Action; import org.argouml.kernel.Project; import org.argouml.kernel.ProjectManager; import org.argouml.model.Model; import org.argouml.model.RemoveAssociationEvent; import org.argouml.model.UmlChangeEvent; import org.argouml.ui.ActionCreateContainedModelElement; import org.argouml.ui.UndoableAction; /** * The model for the signal combobox on the reception proppanel. */ public class UMLSignalComboBoxModel extends UMLComboBoxModel { /** * Constructor for UMLReceptionSignalComboBoxModel. */ public UMLSignalComboBoxModel( final String propertyName, final Object target) { super(target, propertyName, false); Model.getPump().addClassModelEventListener(this, Model.getMetaTypes().getNamespace(), propertyName); } /* * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList() */ protected void buildModelList() { Object target = getTarget(); if (Model.getFacade().isAReception(target) || Model.getFacade().isASignalEvent(target)) { removeAllElements(); Project p = ProjectManager.getManager().getCurrentProject(); Object model = p.getRoot(); setElements(Model.getModelManagementHelper() .getAllModelElementsOfKindWithModel( model, Model.getMetaTypes().getSignal())); setSelectedItem(Model.getFacade().getSignal(target)); } else { throw new IllegalStateException( "Expected a Reception or SignalEvent - got a " + target); } } /* * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object) */ protected boolean isValidElement(Object m) { return Model.getFacade().isASignal(m); } /* * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement() */ protected Object getSelectedModelElement() { if (getTarget() != null) { return Model.getFacade().getSignal(getTarget()); } return null; } /** * Override UMLComboBoxModel2's default handling of RemoveAssociation. We * get this from MDR for the previous signal when a different signal is * selected. Don't let that remove it from the combo box. Only remove it if * the signal was removed from the namespace. * <p> * @param evt the event describing the property change */ public void modelChanged(UmlChangeEvent evt) { if (evt instanceof RemoveAssociationEvent) { Object o = getChangedElement(evt); if (contains(o)) { if (o instanceof Collection) { removeAll((Collection) o); } else { removeElement(o); } } } else { super.propertyChange(evt); } } public List<Action> getActions() { final ArrayList<Action> actions = new ArrayList<Action>(); actions.add(new ActionCreateContainedModelElement( Model.getMetaTypes().getSignal(), getTarget())); return actions; } public Action getAction() { return new SetAction(); } class SetAction extends UndoableAction { /** * The class uid */ private static final long serialVersionUID = 6281434994800778660L; /** * Constructor for ActionSetModelElementNamespace. */ public SetAction() { super(); } /* * @see java.awt.event.ActionListener#actionPerformed( * java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { Object source = e.getSource(); UMLComboBox box = (UMLComboBox) source; Object o = getTarget(); o = box.getSelectedItem(); Object signal = o; if (signal != Model.getFacade().getSignal(getTarget())) { super.actionPerformed(e); Model.getCommonBehaviorHelper().setSignal(getTarget(), signal); } } } }

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.3957.055−130.583
Source linesThe number of non-empty source lines.176+70.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.924−7.386

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

Score0.736

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.177−5.231
Indentation frequencyHow rapidly indentation changes from line to line.117+3.31
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.117−2.264
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.175.837+2.048
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.96.944+0.76
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.05+0.455
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.96.977−0.442

Intercept 0.07 + feature contributions = -1.294 (log-odds).
Score = sigmoid(-1.294) = 0.215.

Score0.589
Score42
Run 1

The code is generally clear and well-structured, with logical class organization and reasonable method separation. It avoids deep nesting and most actions are granular. However, several issues reduce readability: over 40 lines of license headers at the top obscure the actual code; method names like getAction() and getActions() are ambiguous and similar; the actionPerformed method has confusing variable reassignment (Object o is assigned three times) and unclear intent; inconsistent indentation (tabs vs spaces) appears in buildModelList and elsewhere; some methods lack Javadoc or have minimal comments; and the modelChanged method could be flatter. The overall reading flow is acceptable but not natural due to these issues.

Run 2

The code is generally well-structured and readable. It follows a logical organization, with clear method separation and consistent naming. Nesting is mostly flat, with only a few conditional blocks that stay shallow. Intent is mostly clear: the class models a combo box for UML signals and handles changes explicitly. Most methods are concise, and actions are generally one per line, especially in getActions() and actionPerformed(). The reading flow is natural—field declarations, constructor, model-building, validation, selection helper, event handling, and inner action class. Minor issues include a slightly confusing variable reassignment in actionPerformed() (Object o is assigned twice, reducing clarity) and a small amount of legacy/boilerplate code (copyright headers). Some duplicated model-facade calls could be extracted for clarity. Overall, it is readable but not perfect.

Run 3

The code is generally readable but has some issues. The class structure is logical with clear method separation, and most methods are concise with single actions per line. However, the 'modelChanged' method and 'actionPerformed' method introduce unnecessary nesting and slightly awkward flow. In 'actionPerformed', the repeated assignment to 'o' is confusing, and the intent could be clearer by directly assigning 'signal'. The 'buildModelList' method has a long condition that wraps across lines, making it harder to follow. The comments, especially the verbose license header, add noise. The method naming is clear, and the code avoids deep nesting overall, but the minor inconsistencies in handling ('modelChanged' directly removes elements rather than calling a helper) slightly reduce clarity. The class is not excessively long for its responsibility, but the 'SetAction' inner class could be simplified.

Run 1

Code Structure: Responsibilities are sensibly separated into short methods, with selection handling encapsulated in an inner action class. Nesting: Mostly shallow, although modelChanged has three nested conditionals. Clarity of intent: Class and method names convey the purpose, and the event-handling comment is useful; generic variables such as o, m, and p, stale constructor documentation, and a redundant overwritten assignment obscure details. Code length: Implementation is reasonably concise, but extensive license text, boilerplate comments, and unnecessary temporary variables add reading overhead. Action granularity: Statements generally perform one action per line, though chained model API calls require additional interpretation. Reading flow: Method organization is natural, but inconsistent indentation, excess blank lines, and a long conditional interrupt the flow.

Run 2

Code Structure: Responsibilities are organized into focused methods, with an inner class encapsulating the selection action. Nesting: Most methods are shallow, although modelChanged has three nested conditionals. Clarity of intent: Class and API names explain the signal-selection purpose, but generic variables such as o, m, and p, stale constructor comments, and a redundant target assignment reduce clarity. Code length: Functional code is reasonably concise; lengthy license headers, boilerplate comments, and unnecessary intermediate variables add visual overhead. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: Method ordering is logical, but inconsistent indentation, excess blank lines, long conditions, and chained API calls interrupt the flow. Overall, the code is readable with modest cleanup needed.

Run 3

Code Structure: Well-organized class with focused methods and an inner action class separating selection behavior. Nesting: Generally shallow, although modelChanged has three nested conditional levels. Clarity of intent: Method names and domain APIs communicate the purpose, but generic variables such as o, m, and p, outdated constructor comments, and redundant reassignment in actionPerformed reduce clarity. Code length: Implementation is reasonably concise, though extensive license boilerplate, redundant variables, and unnecessary blank lines add reading overhead. Action granularity: Statements generally perform one action per line; chained API calls remain understandable. Reading flow: Methods follow a sensible progression from initialization through model management to actions, but inconsistent indentation, a long conditional line, and stale superclass references interrupt the flow.