Sample

Schnappinger/argoUML/org.argouml.uml.diagram.activity.ui.FigSubactivityState

Human rating uses the original dataset scale.

Human3.83
Lines314

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
22.1Δ 22.8
Scalabrino0.7540–1; higher is more readable
50.7Δ 5.8
Dorn0.0350–1; higher is more readable
25.7Δ 19.1
Mi0.5760–1; higher is more readable
53.5Δ 8.6
LLOC112Logical lines; fewer is more readable
21.8Δ 23.1
DeepSeek V4 Pro160–20; mean of three runs
47.4Δ 2.5
GPT-6.1 Sol15.670–20; mean of three runs
32.3Δ 12.5
BTTF0.2050–1; higher is more readable
11.2Δ 33.7
Human3.831–4; original rating
44.9

Views

Source code

/* $Id: FigSubactivityState.java 18726 2010-09-10 08:37:15Z mvw $ ***************************************************************************** * 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: * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: */ // Copyright (c) 1996-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.activity.ui; import java.awt.Color; import java.awt.Dimension; import java.awt.Rectangle; import java.beans.PropertyChangeEvent; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.argouml.model.AssociationChangeEvent; import org.argouml.model.AttributeChangeEvent; import org.argouml.model.Model; import org.argouml.uml.diagram.DiagramSettings; import org.argouml.uml.diagram.state.ui.FigStateVertex; import org.tigris.gef.presentation.Fig; import org.tigris.gef.presentation.FigLine; import org.tigris.gef.presentation.FigRRect; import org.tigris.gef.presentation.FigText; /** * Class to display graphics for a UML SubactivityState in a diagram. * * @author MVW */ public class FigSubactivityState extends FigStateVertex { private static final int PADDING = 8; private static final int X = X0; private static final int Y = Y0; private static final int W = 90; private static final int H = 25; private static final int SX = 3; private static final int SY = 3; private static final int SW = 9; private static final int SH = 5; private FigRRect cover; private FigRRect s1; private FigRRect s2; private FigLine s3; /** * Construct a new FigSubactivityState. * * @param owner owning UML element * @param bounds position and size * @param settings rendering settings */ public FigSubactivityState(Object owner, Rectangle bounds, DiagramSettings settings) { super(owner, bounds, settings); initFigs(); } @Override protected Fig createBigPortFig() { FigRRect frr = new FigRRect(X, Y, W, H, DEBUG_COLOR, DEBUG_COLOR); frr.setCornerRadius(frr.getHeight() / 2); frr.setLineWidth(0); return frr; } private void initFigs() { cover = new FigRRect(X, Y, W, H, LINE_COLOR, FILL_COLOR); cover.setCornerRadius(getHeight() / 2); getNameFig().setLineWidth(0); getNameFig().setBounds(10 + PADDING, 10, 90 - PADDING * 2, 25); getNameFig().setFilled(false); getNameFig().setReturnAction(FigText.INSERT); getNameFig().setEditable(false); // add Figs to the FigNode in back-to-front order addFig(getBigPort()); addFig(cover); addFig(getNameFig()); makeSubStatesIcon(X + W, Y); setBounds(getBounds()); } /** * @param x the x-coordinate of the right corner * @param y the y coordinate of the bottom corner */ private void makeSubStatesIcon(int x, int y) { s1 = new FigRRect(x - 22, y + 3, 8, 6, LINE_COLOR, FILL_COLOR); s2 = new FigRRect(x - 11, y + 9, 8, 6, LINE_COLOR, FILL_COLOR); s1.setFilled(true); s2.setFilled(true); s1.setLineWidth(LINE_WIDTH); s2.setLineWidth(LINE_WIDTH); s1.setCornerRadius(SH); s2.setCornerRadius(SH); s3 = new FigLine(x - 18, y + 6, x - 7, y + 12, LINE_COLOR); addFig(s3); // add them back to front addFig(s1); addFig(s2); } /* * @see java.lang.Object#clone() */ @Override public Object clone() { FigSubactivityState figClone = (FigSubactivityState) super.clone(); Iterator it = figClone.getFigs().iterator(); figClone.setBigPort((FigRRect) it.next()); figClone.cover = (FigRRect) it.next(); figClone.setNameFig((FigText) it.next()); return figClone; } /* * @see org.tigris.gef.presentation.Fig#getMinimumSize() */ @Override public Dimension getMinimumSize() { Dimension nameDim = getNameFig().getMinimumSize(); int w = nameDim.width + PADDING * 2; int h = nameDim.height + PADDING; return new Dimension(Math.max(w, W / 2), Math.max(h, H / 2)); } /* * Override setBounds to keep shapes looking right. * * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int) */ @Override protected void setStandardBounds(int x, int y, int w, int h) { if (getNameFig() == null) { return; } Rectangle oldBounds = getBounds(); getNameFig().setBounds(x + PADDING, y, w - PADDING * 2, h - PADDING); getBigPort().setBounds(x, y, w, h); cover.setBounds(x, y, w, h); ((FigRRect) getBigPort()).setCornerRadius(h); cover.setCornerRadius(h); s1.setBounds(x + w - 2 * (SX + SW), y + h - 1 * (SY + SH), SW, SH); s2.setBounds(x + w - 1 * (SX + SW), y + h - 2 * (SY + SH), SW, SH); s3.setShape(x + w - (SX * 2 + SW + SW / 2), y + h - (SY + SH / 2), x + w - (SX + SW / 2), y + h - (SY * 2 + SH + SH / 2)); calcBounds(); updateEdges(); firePropChange("bounds", oldBounds, getBounds()); } /* * @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color) */ @Override public void setLineColor(Color col) { cover.setLineColor(col); } /* * @see org.tigris.gef.presentation.Fig#getLineColor() */ public Color getLineColor() { return cover.getLineColor(); } /* * @see org.tigris.gef.presentation.Fig#setFillColor(java.awt.Color) */ public void setFillColor(Color col) { cover.setFillColor(col); } /* * @see org.tigris.gef.presentation.Fig#getFillColor() */ public Color getFillColor() { return cover.getFillColor(); } /* * @see org.tigris.gef.presentation.Fig#setFilled(boolean) */ @Override public void setFilled(boolean f) { cover.setFilled(f); } @Override public boolean isFilled() { return cover.isFilled(); } /* * @see org.tigris.gef.presentation.Fig#setLineWidth(int) */ @Override public void setLineWidth(int w) { cover.setLineWidth(w); } /* * @see org.tigris.gef.presentation.Fig#getLineWidth() */ @Override public int getLineWidth() { return cover.getLineWidth(); } /* * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent) */ @Override protected void modelChanged(PropertyChangeEvent mee) { // Let our superclass sort itself out first super.modelChanged(mee); if (mee instanceof AssociationChangeEvent || mee instanceof AttributeChangeEvent) { // TODO: Rather than specifically ignore some item maybe it would be better // to specifically state what items are of interest. Otherwise we may still // be acting on other events we don't need if (!Model.getFacade().isATransition(mee.getNewValue())) { renderingChanged(); updateListeners(getOwner(), getOwner()); } } } /* * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateListeners(java.lang.Object) */ @Override protected void updateListeners(Object oldOwner, Object newOwner) { Set<Object[]> l = new HashSet<Object[]>(); if (newOwner != null) { // add the listeners to the newOwner l.add(new Object[] {newOwner, null}); // and listen to name changes of the submachine Object machine = Model.getFacade().getSubmachine(newOwner); if (machine != null) { l.add(new Object[] {machine, null}); } } updateElementListeners(l); } /* * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateNameText() */ @Override protected void updateNameText() { String s = ""; if (getOwner() != null) { Object machine = Model.getFacade().getSubmachine(getOwner()); if (machine != null) { s = Model.getFacade().getName(machine); } } if (s == null) { s = ""; } getNameFig().setText(s); } }

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.10233.124−337.693
Source linesThe number of non-empty source lines.314+125.6
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.96−7.44

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

Score0.754

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.315−10.117
Indentation frequencyHow rapidly indentation changes from line to line.230+7.218
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.230−4.857
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.313.942+3.978
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.102.978+0.857
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.102.968−0.696
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.074+0.223

Intercept 0.07 + feature contributions = -3.323 (log-odds).
Score = sigmoid(-3.323) = 0.035.

Score0.576
Score112
Run 1

The code is well-structured with clear sections, imports, and constants. The class follows logical organization, with fields and methods grouped meaningfully. Nesting is minimal; no excessively deep conditional or loop constructs exist. Intent is mostly clear through method names like initFigs() and makeSubStatesIcon(), though some magic numbers (e.g., -22, +3) make the icon layout logic harder to understand without comments. Code length is reasonable but could be slightly shorter in repetitive getters/setters. Action granularity is mostly one action per line, improving readability. Reading flow is natural and easy to follow. However, the heavy use of hard-coded numbers and lack of explanatory comments for layout calculations reduces clarity in some areas.

Run 2

The code demonstrates strong readability with clear logical organization into small, purposeful methods. The file begins with copyright headers which, while typical, delay the actual code. The class structure is well-segmented, with constants, fields, constructors, and overrides grouped logically. Nesting is minimal, mostly limited to simple null checks and conditionals. Each method has a clear single responsibility, such as `makeSubStatesIcon` and `updateNameText`, and the action granularity is mostly one action per line, making lines easy to follow. Naming is descriptive and self-documenting. However, a few minor issues: some magic numbers are scattered in `setStandardBounds` and `makeSubStatesIcon`, which could benefit from named constants. Also, the `initFigs` method performs multiple setup actions but is still coherent. The comments are generally helpful, though some are verbose. Overall, the code is highly readable and maintainable, with only minor opportunities for improvement.

Run 3

The code is well-structured into logical methods with clear responsibilities, and the class has a single, focused purpose (displaying a UML subactivity state). Nesting is minimal—most methods are flat, with only shallow conditional checks. Intent is generally clear through descriptive method names like `makeSubStatesIcon`, `updateListeners`, and `updateNameText`. However, some magic numbers and coordinate arithmetic (especially in `setStandardBounds`) obscure the graphical layout logic and reduce clarity. Code length is reasonable, though the file contains several boilerplate getter/setter overrides that add length without much complexity. Action granularity is mostly one action per line, though some long conditional expressions and chained booleans reduce readability slightly. Reading flow is natural, starting with fields and constructors, then initialization, followed by public overrides and protected behavior methods. Overall, the code is readable but could be improved with named constants or helper methods for coordinate calculations.

Run 1

Code Structure: Well organized into focused methods for initialization, layout, styling, and model updates. Nesting: Mostly flat, with only shallow conditional nesting and an early return. Clarity of intent: Class documentation and descriptive method names establish the purpose, but terse identifiers such as s1, s2, s3, l, and mee, magic numbers, and dense coordinate calculations obscure details. Code length: Most methods are concise; lengthy headers, repetitive delegation methods, and boilerplate comments increase reading overhead. Action granularity: Statements generally perform one action per line, making execution easy to follow. Reading flow: Consistent formatting and logical method grouping support natural reading, although clone's dependence on figure ordering and inherited framework behavior require extra context.

Run 2

Code Structure: Well-organized class with focused methods separating initialization, layout, styling, and model updates. Nesting: Mostly flat, with early returns and only shallow conditional nesting. Clarity of intent: Class documentation and descriptive method names establish purpose, but terse identifiers such as s1, s2, s3, l, and mee, magic coordinates, and dense layout arithmetic obscure details. Code length: Methods are generally concise; lengthy license headers, repetitive delegation methods, and boilerplate comments increase scanning effort. Action granularity: Statements typically perform one action per line, although some coordinate expressions are complex. Reading flow: Consistent formatting and logical method grouping support natural reading, but cloning depends on implicit figure ordering, and rendering behavior requires familiarity with inherited methods and the graphics framework.

Run 3

Code Structure: Responsibilities are logically separated into initialization, geometry, styling, and model-event methods, though cloning depends on implicit figure ordering. Nesting: Mostly flat, with an early return and only shallow nested conditionals. Clarity of intent: Class documentation and descriptive method names establish purpose, but terse identifiers such as s1, s2, s3, l, and mee, magic numbers, and dense coordinate arithmetic obscure details. Code length: Methods are generally concise, while extensive headers, repetitive accessor documentation, and repeated styling calls add visual bulk. Action granularity: Statements generally perform one action per line; chained calls and geometry expressions occasionally increase cognitive load. Reading flow: Consistent formatting and sensible method grouping support navigation, but understanding layout and initialization requires tracking dependencies across methods and inherited behavior.