Sample

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

Human rating uses the original dataset scale.

Human3.95
Lines107

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.010–1; higher is more readable
70.9Δ 1.4
Scalabrino0.7160–1; higher is more readable
41.4Δ 28.0
Dorn0.4210–1; higher is more readable
57.1Δ 12.4
Mi0.5590–1; higher is more readable
45.2Δ 24.3
LLOC19Logical lines; fewer is more readable
61.6Δ 7.9
DeepSeek V4 Pro16.670–20; mean of three runs
59.9Δ 9.6
GPT-6.1 Sol15.670–20; mean of three runs
32.3Δ 37.1
BTTF0.6150–1; higher is more readable
60.7Δ 8.7
Human3.951–4; original rating
69.5

Views

Source code

/* $Id: CrMultiComposite.java 19577 2011-06-22 20:37:05Z 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: * 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 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 MAssociationEnd. See page 2-45 of UML * chapter 2: Semantics. OMG document UML V1.3 June 1999. * * Well-formedness rule [1] for AssociationEnd. See page 53 of UML 1.4 * Semantics. OMG document UML 1.4.2 formal/04-07-02. * * @author jrobbins */ public class CrMultiComposite extends CrUML { /** * The constructor. */ public CrMultiComposite() { setupHeadAndDesc(); addSupportedDecision(UMLDecision.CONTAINMENT); setKnowledgeTypes(Critic.KT_SEMANTICS); addTrigger("aggregation"); addTrigger("multiplicity"); } /* * @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().isAAssociationEnd(dm)) { if (Model.getFacade().isComposite(dm)) { if (Model.getFacade().getUpper(dm) > 1) { problem = PROBLEM_FOUND; } } } return problem; } /* * @see org.argouml.cognitive.critics.Critic#getWizardClass(org.argouml.cognitive.ToDoItem) */ @Override public Class getWizardClass(ToDoItem item) { return WizAssocComposite.class; } /* * @see org.argouml.uml.cognitive.critics.CrUML#getCriticizedDesignMaterials() */ @Override public Set<Object> getCriticizedDesignMaterials() { Set<Object> ret = new HashSet<Object>(); ret.add(Model.getMetaTypes().getAssociationEnd()); return ret; } } /* end class CrMultiComposite */

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.1468.788−48.47
Source linesThe number of non-empty source lines.107+42.8
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.195−7.793

Intercept 8.87 + feature contributions = -4.593 (log-odds).
Score = sigmoid(-4.593) = 0.01.

Score0.716

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.108−2.788
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.106.812+1.083
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.55−0.841
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.94.12+0.714
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.032+0.635
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.94.972−0.357

Intercept 0.07 + feature contributions = -0.319 (log-odds).
Score = sigmoid(-0.319) = 0.421.

Score0.559
Score19
Run 1

The code is highly readable with a clear, logical structure. The class has a single responsibility and follows standard Java conventions. Methods are short with descriptive names, and the predicate2 method uses minimal nesting (three levels) but remains easy to follow. Each line performs one action, and comments are concise and informative. The only deductions are for the lengthy copyright header (which is standard but adds noise) and the shallow nesting in predicate2, which could be simplified with an early return or combined condition. Overall, the code flows naturally from constructor to logic to helper methods, making intent clear.

Run 2

The code is generally readable with clear class structure, logical organization, and well-documented methods. The header comments are lengthy but standard for open-source projects. The constructor cleanly separates setup actions with one method call per line. The predicate2 method uses minimal nesting (three levels) and follows a clear validation flow, though it could be simplified with early returns or logical AND operators. Variable names like 'dm' and 'dsgr' are somewhat cryptic and reduce clarity. Method documentation via Javadoc comments helps establish intent. The getWizardClass and getCriticizedDesignMaterials methods are concise and self-explanatory. Overall, the code maintains good readability with only minor issues around parameter naming and the nested if-structure in predicate2.

Run 3

The code is well-structured and readable. It follows a clear class organization with a constructor and three overridden methods, each with single responsibilities. The nesting level is shallow (maximum depth of three if statements in predicate2), and the intent of each method is evident from its name and Javadoc comments. The code is concise with no unnecessary verbosity. Each logical action occupies its own line, and the reading flow is natural—fields are declared at the top, constructor follows, then methods in logical order. The only minor deductions are the long copyright header, which slightly delays the code start, and the predicate method could be simplified, but overall this is very clean and easily maintainable code.

Run 1

Code Structure: Clearly organized into a constructor and short, focused overridden methods. Nesting: The predicate uses three nested conditionals for a simple check; a combined condition or early returns would be easier to scan. Clarity of intent: UML references and descriptive API calls explain the rule, but names such as dm, dsgr, and ret are vague, and predicate2 lacks a plain-language explanation. Code length: Implementation is concise, although extensive license text and boilerplate comments add visual bulk. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Consistent formatting and conventional method ordering support natural reading, while repeated facade calls and nested checks slightly interrupt the flow.

Run 2

Code Structure: The class is logically organized into a constructor and small, focused overridden methods. Nesting: The predicate uses three nested conditionals for a simple conjunction; combining conditions would improve readability. Clarity of intent: UML references, descriptive API calls, and named result constants clarify the validation rule, though names such as dm, dsgr, and ret are vague. Code length: Implementation methods are concise, but extensive license text and boilerplate comments add visual bulk, while the predicate could be shorter. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Consistent formatting and conventional method organization support natural reading, although repeated facade calls and nested checks slightly interrupt the flow.

Run 3

Code Structure: Well organized into a constructor and small, focused overrides, with consistent formatting. Nesting: The predicate uses three nested conditionals where a combined condition or early returns would be easier to scan. Clarity of intent: Domain-specific method names and UML rule references explain the purpose, although dm, dsgr, and ret are terse and the multiplicity constraint is not explained directly. Code length: Implementation is concise, but extensive license text and boilerplate comments add visual overhead. Action granularity: Statements generally perform one action per line, making execution easy to follow. Reading flow: Method ordering and spacing are natural; repeated facade calls and the temporary problem variable make the central predicate slightly more cumbersome than necessary.