Sample

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

Human rating uses the original dataset scale.

Human3.91
Lines79

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett10–1; higher is more readable
96.7Δ 40.7
Scalabrino0.7820–1; higher is more readable
58.9Δ 3.0
Dorn0.6290–1; higher is more readable
70.0Δ 14.0
Mi0.6560–1; higher is more readable
75.6Δ 19.6
LLOC6Logical lines; fewer is more readable
79.7Δ 23.8
DeepSeek V4 Pro17.330–20; mean of three runs
73.9Δ 18.0
GPT-6.1 Sol180–20; mean of three runs
73.8Δ 17.8
BTTF0.3790–1; higher is more readable
32.3Δ 23.6
Human3.911–4; original rating
55.9

Views

Source code

/* $Id: UMLDiscriminatorNameDocument.java 17896 2010-01-12 21:36:11Z 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: * 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 org.argouml.model.Model; /** * The document that is edited in the discriminator field of a generalization. * * @since Oct 10, 2002 * @author jaap.branderhorst@xs4all.nl */ class UMLDiscriminatorNameDocument extends UMLPlainTextDocument { /** * The class uid */ private static final long serialVersionUID = -9181779607372279972L; /** * Constructor for UMLModelElementNameDocument. */ public UMLDiscriminatorNameDocument( final String propertyName, final Object target) { super(propertyName, target); } /* * @see org.argouml.uml.ui.UMLPlainTextDocument#setProperty(java.lang.String) */ protected void setProperty(String text) { Model.getCoreHelper().setDiscriminator(getTarget(), text); } /* * @see org.argouml.uml.ui.UMLPlainTextDocument#getProperty() */ protected String getProperty() { return (String) Model.getFacade().getDiscriminator(getTarget()); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.79+31.6
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.565.661−18.667
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.197−7.795

Intercept 8.87 + feature contributions = 14.008 (log-odds).
Score = sigmoid(14.008) = 1.

Score0.782

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.80−1.796
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.016+0.784
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.78.732+0.691
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.80.9+0.501
Indentation frequencyHow rapidly indentation changes from line to line.31+0.335
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.31−0.291
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.80.963+0.236

Intercept 0.07 + feature contributions = 0.53 (log-odds).
Score = sigmoid(0.53) = 0.629.

Score0.656
Score6
Run 1

The code is well-structured with clear separation of concerns: license headers, package declaration, imports, class definition, and methods are all logically organized. The class has a single clear responsibility as a document model for a discriminator field. Nesting is minimal—only one level inside method bodies where needed. Intent is explicit through descriptive method names like setProperty and getProperty, plus clear Javadoc comments. Code length is appropriate and concise; there is no redundancy or unnecessary verbosity beyond the required license text. Action granularity is appropriate: each method performs a single, focused operation in one line. Reading flow is natural—constructor flows to overridden methods, and each method directly expresses its purpose. Minor deductions: the class name 'UMLDiscriminatorNameDocument' is lengthy, and the license header adds visual noise before the actual code, slightly impacting initial readability.

Run 2

The code is well-structured and highly readable. It begins with extensive license headers, which are standard but contribute to length. The package and import statements are clear, and the class has a single, well-defined responsibility. Nesting is minimal—there are no conditional or loop structures, keeping the flow flat. Intent is clear: the class extends UMLPlainTextDocument to handle discriminator name editing. The constructor is concise, and setProperty/getProperty methods are straightforward, each performing one action per line by delegating to model helpers. Reading flow is natural, moving from class declaration to behavior. Deductions are mainly for lengthy legal comments and slightly redundant Javadoc, but these do not harm logic comprehension.

Run 3

The code is highly readable. It has a clear, logical structure: package declaration, imports, class definition, serial version UID, constructor, and two overridden methods. Nesting is minimal and flat. The intent of each method is explicit through names like setProperty and getProperty, supported by brief Javadoc comments. The code is concise without being cryptic; there is no unnecessary repetition or dead code. Action granularity is appropriate, with one logical operation per line in the methods. Reading flow is natural, moving from class-level metadata to constructor and then property accessors. The only minor issue is the lengthy license header, which is not part of the logic and is common in open-source projects. Overall, the code is easy to follow and maintain.

Run 1

Code Structure: A small, logically organized class separates construction, property updating, and property retrieval. Nesting: No nested control flow; all methods are flat. Clarity of intent: The class description and discriminator-specific API calls clearly communicate purpose, although the constructor comment names a different class and the @see references appear outdated. Code length: The implementation is concise, but lengthy licensing comments dominate the file and delay reaching the functional code. Action granularity: Each method performs a single clear operation, with one statement per line. Reading flow: Conventional Java ordering and consistent formatting make the implementation easy to follow; misleading comments and verbose headers slightly interrupt that flow.

Run 2

Code Structure: The class is logically organized into a constant, constructor, setter, and getter, with clear separation of responsibilities. Nesting: There is no control-flow nesting, making the implementation easy to scan. Clarity of intent: The class description and discriminator accessors clearly convey its purpose, although the constructor comment incorrectly names another class. Code length: The implementation is concise; the lengthy licensing header adds visual overhead without complicating the logic. Action granularity: Each executable statement performs one focused action, despite chained model-access calls. Reading flow: Conventional Java formatting and method ordering provide a natural flow, slightly weakened by stale documentation references and unnecessary constructor line wrapping.

Run 3

Code Structure: A well-organized class with a constant, constructor, and two focused property methods. Nesting: Flat implementation with no conditional or loop nesting. Clarity of intent: The class name, description, and discriminator accessors communicate the purpose clearly, although the constructor comment incorrectly names another class. Code length: The executable code is concise; extensive licensing text and routine comments add considerable visual overhead. Action granularity: Each statement performs one focused operation, with short helper-call chains that remain easy to follow. Reading flow: Conventional Java ordering and consistent formatting support natural reading, slightly weakened by outdated documentation references and the large header.