Sample

Schnappinger/argoUML/org.argouml.uml.cognitive.critics.CrCircularInheritance

Human rating uses the original dataset scale.

Human3.73
Lines108

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
62.9Δ 20.3
Scalabrino0.6470–1; higher is more readable
28.8Δ 13.8
Dorn0.4710–1; higher is more readable
58.7Δ 16.2
Mi0.5840–1; higher is more readable
56.4Δ 13.9
LLOC19Logical lines; fewer is more readable
61.6Δ 19.0
DeepSeek V4 Pro160–20; mean of three runs
47.4Δ 4.8
GPT-6.1 Sol160–20; mean of three runs
38.9Δ 3.6
BTTF0.6860–1; higher is more readable
77.2Δ 34.7
Human3.731–4; original rating
42.6

Views

Source code

/* $Id: CrCircularInheritance.java 19907 2012-12-30 13:06:01Z closettop_nightlybuild $ ***************************************************************************** * Copyright (c) 2009-2012 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: * maurelio1234 ***************************************************************************** * * 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.uml.cognitive.critics; import java.util.HashSet; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.argouml.cognitive.Critic; import org.argouml.cognitive.Designer; import org.argouml.cognitive.ToDoItem; import org.argouml.model.Model; import org.argouml.uml.cognitive.UMLDecision; /** * Well-formedness rule [2] for GeneralizableElement. See page 31 of UML 1.1 * Semantics. OMG document ad/97-08-04. * * Well-formedness rule [3] for GeneralizableElement. See page 59 of UML 1.4 * Semantics. OMG document UML 1.4.2 formal/04-07-02. * * @author jrobbins */ public class CrCircularInheritance extends CrUML { /** * Logger. */ private static final Logger LOG = Logger.getLogger(CrCircularInheritance.class.getName()); /** * The constructor. */ public CrCircularInheritance() { setupHeadAndDesc(); setPriority(ToDoItem.HIGH_PRIORITY); addSupportedDecision(UMLDecision.INHERITANCE); setKnowledgeTypes(Critic.KT_SYNTAX); addTrigger("generalization"); // no need for trigger on "specialization" } /* * @see org.argouml.uml.cognitive.critics.CrUML#predicate2( * java.lang.Object, org.argouml.cognitive.Designer) */ @Override public boolean predicate2(Object dm, Designer dsgr) { boolean problem = NO_PROBLEM; if (Model.getFacade().isAGeneralizableElement(dm)) { try { Model.getCoreHelper().getChildren(dm); } catch (IllegalStateException ex) { problem = PROBLEM_FOUND; LOG.log(Level.INFO, "problem found for: {0}", this); } } return problem; } /* * @see org.argouml.uml.cognitive.critics.CrUML#getCriticizedDesignMaterials() */ @Override public Set<Object> getCriticizedDesignMaterials() { Set<Object> ret = new HashSet<Object>(); ret.add(Model.getMetaTypes().getGeneralizableElement()); return ret; } } /* end class CrCircularInheritance */

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.1695.717−55.959
Source linesThe number of non-empty source lines.108+43.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.283−7.924

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

Score0.647

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.109−2.823
Indentation frequencyHow rapidly indentation changes from line to line.55+1.165
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.107.828+1.097
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.034+0.615
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85.807+0.58
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.86+0.023

Intercept 0.07 + feature contributions = -0.114 (log-odds).
Score = sigmoid(-0.114) = 0.471.

Score0.584
Score19
Run 1

The code is generally readable with clear class structure and purpose. It has a logical organization, beginning with documentation, then fields, constructor, and overridden methods. Nesting is minimal—only one if statement and a try-catch block. The intent is mostly clear: detect circular inheritance in UML models. Action granularity is mostly one action per line, though some method calls are combined. The reading flow is natural, with methods arranged in a typical order. However, several issues reduce readability: excessive license headers (28+ lines) before reaching actual code, inconsistent indentation (mixed tabs/spaces), and terse variable names like 'dm' and 'dsgr' that obscure meaning. The predicate2 method catches an exception to set a boolean, which is a somewhat unclear pattern. The setupHeadAndDesc method call without definition in this snippet adds minor ambiguity. Overall, the code is understandable but could be improved with cleaner formatting and more descriptive variable names.

Run 2

The code is generally well-structured and readable. It has a clear class purpose, good use of comments and Javadoc, and a flat, logical organization. The methods are concise and each line typically represents one action. The reading flow is natural, with imports and class definition properly ordered. However, readability is slightly reduced by inconsistent indentation (mix of tabs and spaces) and the extensive copyright header, which adds length before reaching the actual code. The predicate2 method has a nested if-try-catch structure, but it remains understandable. Overall, the code is maintainable and clear, with minor formatting inconsistencies preventing a higher score.

Run 3

The code is relatively readable with a clear class purpose and logical organization. The structure is standard: copyright header, package, imports, Javadoc, class definition, constructor, and overridden methods. Nesting is minimal with only one conditional and one try-catch. The intent is clear from the class name and documentation, though the predicate2 method's actual circular inheritance check is missing (it only catches exceptions), which slightly obscures the purpose. Code length is appropriate but the extensive license header adds noise. Action granularity is generally one action per line, though the constructor could be more consistently indented. Reading flow is natural overall, but the mixed indentation styles (tabs vs spaces) in the constructor and methods reduce fluidity. Variable names like 'dm' and 'dsgr' are cryptic. The use of constants like NO_PROBLEM and PROBLEM_FOUND improves clarity. Overall, the code is understandable but could benefit from consistent formatting and clearer naming.

Run 1

Code Structure: The class is logically organized into logger setup, constructor configuration, predicate evaluation, and supported material types. Nesting: The predicate has modest nesting through an if and try/catch, remaining easy to follow. Clarity of intent: Class and method names indicate circular-inheritance checking, but detecting cycles indirectly through getChildren throwing IllegalStateException is not explained; abbreviated names such as dm and ret also reduce clarity. Code length: Executable code is concise, although extensive licensing text and boilerplate comments add scanning overhead. Action granularity: Each statement performs one action, with no crowded multi-action lines. Reading flow: Methods follow a natural order, but mixed tabs and spaces disrupt visual consistency, and the exception-driven detection requires knowledge of the model API.

Run 2

Code Structure: The class is logically organized into logger setup, initialization, validation, and supported material types. Nesting: The validation method has modest nesting through an if statement and try/catch, remaining easy to follow. Clarity of intent: The class name and UML references establish its purpose, but detecting circular inheritance through an exception from getChildren is implicit rather than explained. Generic names such as dm and ret also reduce clarity. Code length: Executable code is concise; extensive licensing text and boilerplate comments add scanning overhead. Action granularity: Statements generally perform one action per line, with no compressed sequences. Reading flow: Method ordering is natural, but inconsistent tab/space indentation disrupts visual consistency. Overall, readable and compact, with room for clearer naming and an explanation of the exception-based detection mechanism.

Run 3

Code Structure: The class is logically organized into a logger, constructor, predicate, and metadata method with clear responsibilities. Nesting: Nesting is modest, although the conditional containing a try/catch slightly complicates the predicate. Clarity of intent: The class name and UML references establish the purpose, but detecting circular inheritance through an exception from getChildren is implicit and deserves an explanatory comment; names such as dm and ret are vague. Code length: Implementation is concise, though extensive license headers and boilerplate comments add reading overhead. Action granularity: Each statement generally performs one action, with no compressed multi-statement lines. Reading flow: Method ordering and spacing are sensible, but mixed tabs and spaces disrupt visual consistency, and understanding the predicate requires knowledge of the model API's exception behavior.