Sample

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

Human rating uses the original dataset scale.

Human3.66
Lines115

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
62.5Δ 21.6
Scalabrino0.7460–1; higher is more readable
47.6Δ 6.7
Dorn0.4620–1; higher is more readable
58.4Δ 17.5
Mi0.5750–1; higher is more readable
52.8Δ 11.9
LLOC21Logical lines; fewer is more readable
58.4Δ 17.5
DeepSeek V4 Pro160–20; mean of three runs
47.4Δ 6.4
GPT-6.1 Sol160–20; mean of three runs
38.9Δ 2.0
BTTF0.4340–1; higher is more readable
37.3Δ 3.6
Human3.661–4; original rating
40.9

Views

Source code

/* $Id: UMLMessageActivatorComboBoxModel.java 18691 2010-08-28 00:41:40Z bobtarling $ ***************************************************************************** * 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: * bobtarling ***************************************************************************** * * 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 javax.swing.Action; import org.argouml.model.Model; /** * The model behind the UMLMessageActivatorComboBox. */ class UMLMessageActivatorComboBoxModel extends UMLComboBoxModel { /** * The class uid */ private static final long serialVersionUID = 5785236557511670953L; private Object interaction = null; /** * Constructor for UMLMessageActivatorComboBoxModel. */ public UMLMessageActivatorComboBoxModel( final String propertyName, final Object target) { super(target, propertyName, false); if (Model.getFacade().isAMessage(target)) { interaction = Model.getFacade().getInteraction(target); if (interaction != null) { Model.getPump().addModelEventListener( this, interaction, "message"); } } } /* * @see org.argouml.uml.ui.UMLComboBoxModel#buildModelList() */ protected void buildModelList() { Object target = getTarget(); if (Model.getFacade().isAMessage(target)) { Object mes = target; removeAllElements(); // fill the list with items setElements(Model.getCollaborationsHelper() .getAllPossibleActivators(mes)); } } /* * @see org.argouml.uml.ui.UMLComboBoxModel#isValidElement(Object) */ protected boolean isValidElement(Object m) { return ((Model.getFacade().isAMessage(m)) && m != getTarget() && !Model.getFacade().getPredecessors((getTarget())).contains(m) && Model.getFacade().getInteraction(m) == Model.getFacade().getInteraction((getTarget()))); } /* * @see org.argouml.uml.ui.UMLComboBoxModel#getSelectedModelElement() */ protected Object getSelectedModelElement() { if (getTarget() != null) { return Model.getFacade().getActivator(getTarget()); } return null; } public Action getAction() { return null; } }

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.1795.906−59.265
Source linesThe number of non-empty source lines.115+46
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.04−7.561

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

Score0.746

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.116−3.071
Indentation frequencyHow rapidly indentation changes from line to line.66+1.546
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.114.802+1.195
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.66−1.094
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.84.922+0.566
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.041+0.541
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.84.259+0.096

Intercept 0.07 + feature contributions = -0.151 (log-odds).
Score = sigmoid(-0.151) = 0.462.

Score0.575
Score21
Run 1

The code is well-structured and readable. It uses clear naming conventions, logical organization, and appropriate comments. Indentation and braces are consistent. The methods are short and focused, with generally one action per line. The class hierarchy and overridden methods are clear. Minor deductions: the isValidElement method contains a long conditional expression that could benefit from being broken into named boolean variables for improved readability. The getAction() method returning null is unclear without context, but this may be an override requirement. Long copyright headers are boilerplate and not part of code readability per se, though they do push the actual code down the file. Overall, this is clean, maintainable Java code with only minor opportunities for improvement in expression clarity.

Run 2

The code is generally well-structured and readable. It has a clear class purpose, logical organization, and minimal nesting. Methods are short and focused, with one primary action per line in most cases. Naming is descriptive (e.g., getSelectedModelElement, isValidElement). The buildModelList method is flat and straightforward. However, readability suffers slightly from redundant local variable (Object mes = target;), some overly long boolean expressions in isValidElement, and extraneous comments. The constructor mixes setup logic with conditional listener registration, but remains understandable. Overall, a clean implementation with minor clarity issues.

Run 3

The code is generally well-structured with clear separation of methods and logical organization. It uses standard Java conventions, meaningful method names, and follows a consistent pattern. Nesting is minimal (maximum 2-3 levels), and each line typically performs one action. The intent is mostly clear - it's a combo box model for UML message activators. However, there are some readability issues: the isValidElement method contains a complex boolean expression that could be broken down or extracted into helper methods for better clarity. The buildModelList method has an unnecessary variable reassignment (Object mes = target) that adds confusion. The comments are sporadic and could better explain non-obvious business logic. The reading flow is generally natural, though the boolean expression in isValidElement disrupts flow. Overall, it's readable but could benefit from simplifying complex conditions and removing redundant variable assignments.

Run 1

Code Structure: A small, focused class with clearly separated constructor, list-building, validation, and selection methods. Nesting: Mostly flat, with only two nested checks in the constructor. Clarity of intent: Class and method names explain the purpose, but generic Object types, abbreviated names such as mes and m, and an unexplained null-returning getAction reduce clarity. Code length: Implementation is concise, although extensive license boilerplate, redundant comments, and the unnecessary target alias add reading overhead. Action granularity: Statements generally perform one action per line; the validation expression combines several related conditions but formats them separately. Reading flow: Consistent formatting and short methods support natural reading, while repeated facade calls and redundant parentheses make the validation logic slightly harder to scan.

Run 2

Code Structure: A small, focused class with clearly separated constructor, list-building, validation, and selection methods. Nesting: Mostly shallow; the constructor has only two nested conditions. Clarity of intent: Descriptive class and method names convey purpose, but generic Object types, abbreviated variables such as mes and m, and unexplained validation rules reduce clarity. Code length: Implementation is concise, though the lengthy license header, redundant comments, and unnecessary target alias add reading overhead. Action granularity: Statements generally perform one action each; the validation expression combines several checks but remains manageable. Reading flow: Conventional Java organization and consistent formatting support natural reading, while repeated facade calls, extra parentheses, and uneven expression wrapping slightly disrupt it.

Run 3

Code Structure: The class is logically organized into construction, list building, validation, and selection methods. Nesting: Mostly shallow, with only two nested conditions in the constructor. Clarity of intent: Class and method names convey their purposes, but generic Object types, abbreviated variables such as mes and m, and an unexplained null-returning getAction reduce clarity. Code length: Methods are concise, though the extensive license header, redundant comments, and unnecessary target alias add reading overhead. Action granularity: Statements generally perform one action each; the validation expression combines several related checks appropriately. Reading flow: Consistent formatting and method separation support natural reading, but repeated facade calls, extra parentheses, and the multiline validation chain make some expressions harder to scan.