Sample

Schnappinger/argoUML/org.argouml.uml.diagram.ui.FigKeyword

Human rating uses the original dataset scale.

Human3.99
Lines114

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.9590–1; higher is more readable
88.6Δ 0.2
Scalabrino0.8050–1; higher is more readable
63.7Δ 25.1
Dorn0.4970–1; higher is more readable
60.4Δ 28.4
Mi0.5130–1; higher is more readable
36.3Δ 52.5
LLOC20Logical lines; fewer is more readable
59.7Δ 29.0
DeepSeek V4 Pro170–20; mean of three runs
66.8Δ 21.9
GPT-6.1 Sol180–20; mean of three runs
73.8Δ 15.0
BTTF0.6960–1; higher is more readable
80.5Δ 8.3
Human3.991–4; original rating
88.8

Views

Source code

/* $Id: FigKeyword.java 17865 2010-01-12 20:45:26Z 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) 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.diagram.ui; import java.awt.Rectangle; import org.argouml.notation.providers.uml.NotationUtilityUml; import org.argouml.uml.diagram.DiagramSettings; import org.tigris.gef.presentation.FigText; /** * Fig to show a keyword within a FigStereotypesGroup, * which resembles a stereotype, but isn't one. * E.g. <<interface>>. * <p> * The keyword is not editable on the fig, hence we * do not use a Notation Provider. <p> * This Fig does not need to listen to model changes * and is frozen.<p> * * This Fig only supports updates of the text * for changes in guillemet style. * * @author Michiel */ public class FigKeyword extends FigSingleLineText { private final String keywordText; /** * @param keyword the text to show * @param bounds position and size * @param settings rendering settings */ public FigKeyword(String keyword, Rectangle bounds, DiagramSettings settings) { super(bounds, settings, true); initialize(); keywordText = keyword; setText(keyword); } private void initialize() { setEditable(false); setTextColor(TEXT_COLOR); setTextFilled(false); setJustification(FigText.JUSTIFY_CENTER); setRightMargin(3); setLeftMargin(3); super.setLineWidth(0); } /* Force the line-width to 0, since the FigGroup that contains the * stereotype may want to show a border, but we don't. */ @Override public void setLineWidth(int w) { super.setLineWidth(0); } /** * This is needed for updating the guillemet style. */ @Override protected void setText() { setText(keywordText); } /** * Add guillemets to any text set to this Fig. * {@inheritDoc} */ @Override public void setText(String text) { assert keywordText.equals(text); super.setText(NotationUtilityUml.formatStereotype(text, getSettings().getNotationSettings().isUseGuillemets())); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.114+45.6
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.1323.722−43.683
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.092−7.638

Intercept 8.87 + feature contributions = 3.149 (log-odds).
Score = sigmoid(3.149) = 0.959.

Score0.805

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.115−3.035
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.113.899+1.182
Indentation frequencyHow rapidly indentation changes from line to line.55+1.165
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.55−0.841
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.028+0.673
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.75.304+0.411
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.974+0.363

Intercept 0.07 + feature contributions = -0.013 (log-odds).
Score = sigmoid(-0.013) = 0.497.

Score0.513
Score20
Run 1

The code is generally readable and well-structured. The class has a clear single responsibility, with logical grouping of fields, constructor, initialization, and overridden methods. The copyright header, while lengthy, is standard legal boilerplate and not part of the actual logic. Nesting is minimal, and each method performs a single clear action, giving good action granularity. The intent is clearly expressed through meaningful names and Javadoc comments explaining non-obvious behavior. However, the reading flow is slightly disrupted by the placement of the setLineWidth override between initialization and setText methods, and the empty initialize() method adds minor indirection. The assert in setText also introduces a subtle runtime dependency that could be clearer. Overall, the code is concise and maintainable, but these minor organizational issues prevent a higher score.

Run 2

The code is highly readable with clear structure and organization. It follows logical class organization with fields, constructors, and methods in sensible order. Nesting is minimal—only one method contains an assertion, and there are no deep conditional blocks. Intent is clearly expressed through descriptive method names like `initialize()` and comments explaining non-obvious decisions (e.g., forcing line-width to 0). Code length is concise and appropriate; the class is focused and doesn't contain unnecessary boilerplate. Action granularity is good—most lines perform a single clear action, particularly in the `initialize()` method. Reading flow is natural: the constructor calls initialization, sets the keyword, and updates text in logical sequence. Minor deductions: the dual license header is verbose but standard; the `setText()` assertion could be clearer with an error message. Overall, well-structured, maintainable code that follows clean code principles.

Run 3

The code is highly readable. It has a clear, logical class structure with a single purpose, well-organized imports, and concise Javadoc that explains intent. Nesting is minimal—methods are flat and straightforward. Each method performs one cohesive action, with one action per line and good use of whitespace. The reading flow is natural, from constructor to initialization to overridden methods. The only minor weakness is some redundant code: the constructor calls setText(keyword) after assigning keywordText, and initialize() sets line width via super.setLineWidth(0), while the overridden setLineWidth also forces 0. This slight redundancy does not significantly harm readability but could confuse maintainers. Overall, the code is clean, expressive, and easy to follow.

Run 1

Code Structure: A focused class with logically separated construction, initialization, and overrides. Nesting: Almost entirely flat, with no nested control flow. Clarity of intent: Descriptive names and documentation clearly explain the noneditable keyword display and guillemet formatting; the ignored line-width parameter is explicitly justified. The assertion and reliance on superclass behavior require slightly more attention. Code length: Implementation is concise, although extensive licensing comments dominate the file. Action granularity: Statements generally perform one action per line; the chained settings lookup adds minor density. Reading flow: Imports, class documentation, field, constructor, and methods follow a natural order, with consistent formatting and helpful comments.

Run 2

Code Structure: A focused class with clearly separated construction, initialization, and rendering overrides. Nesting: Almost entirely flat, with no nested control flow. Clarity of intent: Descriptive names and documentation explain the noneditable keyword and guillemet formatting; the ignored line-width parameter is explicitly justified. The overloaded setText methods and constructor initialization order require some attention. Code length: Implementation is concise, although the lengthy license header adds substantial visual overhead. Action granularity: Statements generally perform one action per line; the chained settings lookup is slightly denser but still readable. Reading flow: Consistent formatting and a natural progression from setup to behavior make the class easy to follow.

Run 3

Code Structure: A focused class with logically separated construction, initialization, and overrides. Nesting: Almost entirely flat, with no nested control flow. Clarity of intent: Descriptive names and useful documentation explain the noneditable keyword display and guillemet formatting; overloaded setText methods and the assertion require some attention. Code length: Implementation is concise, although the extensive license header delays reaching the functional code. Action granularity: Each statement performs one clear action, and initialization settings are individually listed. Reading flow: Methods follow a natural progression from setup to behavior customization, with consistent formatting. Minor readability costs include unexplained numeric margins, the ignored setLineWidth parameter, and dependencies on inherited behavior.