Sample

Schnappinger/argoUML/org.argouml.uml.diagram.deployment.ui.SelectionComponentInstance

Human rating uses the original dataset scale.

Human3.92
Lines123

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
61.2Δ 3.4
Scalabrino0.8270–1; higher is more readable
69.9Δ 12.1
Dorn0.8530–1; higher is more readable
92.4Δ 34.7
Mi0.5890–1; higher is more readable
58.1Δ 0.3
LLOC21Logical lines; fewer is more readable
58.4Δ 0.7
DeepSeek V4 Pro16.330–20; mean of three runs
53.1Δ 4.6
GPT-6.1 Sol16.330–20; mean of three runs
45.9Δ 11.9
BTTF0.6570–1; higher is more readable
68.3Δ 10.6
Human3.921–4; original rating
57.8

Views

Source code

/* $Id: SelectionComponentInstance.java 17857 2010-01-12 19:59:07Z 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: * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: */ // Copyright (c) 1996-2008 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.diagram.deployment.ui; import javax.swing.Icon; import org.argouml.application.helpers.ResourceLoaderWrapper; import org.argouml.model.Model; import org.argouml.uml.diagram.ui.SelectionNodeClarifiers2; import org.tigris.gef.presentation.Fig; /** * @author 5eichler@informatik.uni-hamburg.de */ public class SelectionComponentInstance extends SelectionNodeClarifiers2 { private static Icon dep = ResourceLoaderWrapper.lookupIconResource("Dependency"); private static Icon depRight = ResourceLoaderWrapper.lookupIconResource("DependencyRight"); private static Icon icons[] = {dep, dep, depRight, depRight, null, }; // TODO: I18N required private static String instructions[] = {"Add a component-instance", "Add a component-instance", "Add a component-instance", "Add a component-instance", null, "Move object(s)", }; /** * Construct a new SelectionComponentInstanceInstance for the given Fig. * * @param f The given Fig. */ public SelectionComponentInstance(Fig f) { super(f); } @Override protected Icon[] getIcons() { if (Model.getModelManagementHelper().isReadOnly( getContent().getOwner())) { return new Icon[] {null, dep, depRight, null, null }; } return icons; } @Override protected String getInstructions(int index) { return instructions[index - BASE]; } @Override protected Object getNewEdgeType(int index) { return Model.getMetaTypes().getDependency(); } @Override protected Object getNewNode(int index) { return Model.getCommonBehaviorFactory().createComponentInstance(); } @Override protected Object getNewNodeType(int index) { return Model.getMetaTypes().getComponentInstance(); } @Override protected boolean isReverseEdge(int index) { if (index == BOTTOM || index == LEFT) { return true; } return false; } }

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.1970.841−65.038
Source linesThe number of non-empty source lines.123+49.2
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.106−7.659

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

Score0.827

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.124−3.354
Indentation frequencyHow rapidly indentation changes from line to line.80+2.03
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.122.911+1.308
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.04+0.558
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.73.613+0.383
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.77.976+0.362

Intercept 0.07 + feature contributions = 1.756 (log-odds).
Score = sigmoid(1.756) = 0.853.

Score0.589
Score21
Run 1

The code is generally readable with clear structure and organization. The class has a logical layout: fields, constructor, then overridden methods. Nesting is minimal, with only one if-statement in getIcons() and one in isReverseEdge(). Intent is clear through descriptive method names like getNewEdgeType() and isReverseEdge(). Code length is appropriate - it's concise without being overly verbose. Action granularity is good with one action per line in most cases, though the return statements in isReverseEdge() could be simplified to a single boolean expression. The main readability drawbacks are the large copyright header (which is boilerplate), the cryptic 'BASE' reference in getInstructions() that isn't defined in this class, and the inconsistent array formatting. The magic number reliance on index positions and null array entries makes the code slightly harder to understand without inspecting parent class constants. Overall, it's a well-structured, readable class with minor clarity issues.

Run 2

The code is generally well-structured and readable. It follows a clear, logical organization with class fields grouped at the top, a simple constructor, and overridden methods that are focused and concise. Nesting is minimal, with only a simple if-else in one method. Each method performs a single, clear action, and the reading flow is natural. The excessive copyright header, while legally required, detracts from immediate readability at the top of the file but is not part of the actual logic. Minor issues include the unused `instructions` array being larger than needed and some redundant methods like `getNewEdgeType` and `getNewNodeType` that add slight noise. Overall, the code is clean, maintainable, and easy to follow.

Run 3

The code is highly readable. It has clear logical structure with a single class, fields, constructor, and overridden methods separated by blank lines. Nesting is minimal, with only one if statement that is short and clear. The intent of each method is obvious from its name and the overriding annotation. Code length is concise—no redundant logic or unnecessary comments. Action granularity is one action per line, which improves clarity. Reading flow is natural: fields are declared first, then constructor, then overridden methods in a logical order. Minor issues include the unused 'index' parameter in some methods and slight inconsistency in icon array formatting, but these are very minor. Overall, the code is well-organized, easy to follow, and maintainable.

Run 1

Code Structure: Logically organized into static resources, a constructor, and small overridden methods. Nesting: Very shallow, with only simple conditionals. Clarity of intent: Class and method names communicate component-instance selection behavior, but abbreviated names such as dep and positional arrays require framework knowledge; the constructor documentation also contains a naming typo. Code length: Implementation is concise, although repeated instruction strings and the verbose boolean conditional could be simplified; the lengthy license header adds scanning overhead. Action granularity: Most lines perform one action, with the compact constructor slightly reducing consistency. Reading flow: Natural top-to-bottom organization and consistent method formatting make navigation easy, though irregular array formatting and unexplained index relationships interrupt the flow.

Run 2

Code Structure: The class is logically organized into icon resources, instruction data, a constructor, and focused overrides. Nesting: Control flow is shallow, with only simple conditionals. Clarity of intent: Descriptive class and method names communicate the purpose, but abbreviated fields such as dep, positional arrays, and the unexplained index - BASE mapping require contextual knowledge. Code length: Implementation methods are concise, although repeated instruction strings and the verbose boolean return pattern add avoidable length; extensive license text delays reaching the implementation. Action granularity: Most statements perform one action, but the inline constructor slightly compresses presentation. Reading flow: The method sequence is coherent and easy to follow, though inconsistent array formatting and a constructor documentation typo reduce polish.

Run 3

Code Structure: Well-organized class with fields, constructor, and short, focused overrides. Nesting: Very shallow, with only simple conditional branches. Clarity of intent: Method names and model factory calls communicate purpose clearly, but abbreviated icon names, positional arrays, null entries, and index-offset conventions require framework knowledge. The constructor documentation also contains a naming typo. Code length: Implementation is concise, although repeated instruction strings and the verbose boolean return could be simplified; lengthy license headers add visual overhead without complicating the logic. Action granularity: Most lines contain a single action, but the constructor places its declaration and superclass call on one line. Reading flow: Methods follow a natural progression and formatting is mostly consistent, though unusual array formatting and implicit relationships between icons, instructions, and direction constants slightly interrupt comprehension.