Sample

Schnappinger/argoUML/org.argouml.cognitive.ui.PriorityNode

Human rating uses the original dataset scale.

Human3.45
Lines122

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.980–1; higher is more readable
90.0Δ 51.4
Scalabrino0.9110–1; higher is more readable
92.5Δ 53.9
Dorn0.8230–1; higher is more readable
89.4Δ 50.8
Mi0.6340–1; higher is more readable
69.6Δ 31.0
LLOC23Logical lines; fewer is more readable
55.9Δ 17.3
DeepSeek V4 Pro17.670–20; mean of three runs
83.0Δ 44.4
GPT-6.1 Sol180–20; mean of three runs
73.8Δ 35.1
BTTF0.7140–1; higher is more readable
84.8Δ 46.2
Human3.451–4; original rating
38.6

Views

Source code

/* $Id: PriorityNode.java 17818 2010-01-12 18:39:46Z 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) 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.cognitive.ui; import java.util.ArrayList; import java.util.List; import org.argouml.cognitive.ToDoItem; import org.argouml.cognitive.Translator; /** * This class represents a "priority". Which is a classification for critics. * */ public class PriorityNode { private static final String HIGH = Translator.localize("misc.level.high"); private static final String MEDIUM = Translator.localize("misc.level.medium"); private static final String LOW = Translator.localize("misc.level.low"); private static List<PriorityNode> priorities = null; private String name; private int priority; /** * The constructor. * * @param n the name of this priority * @param pri the priority number */ public PriorityNode(String n, int pri) { name = n; priority = pri; } /** * @return the list of all the priorities */ public static List<PriorityNode> getPriorityList() { if (priorities == null) { List<PriorityNode> p = new ArrayList<PriorityNode>(); p.add(new PriorityNode(HIGH, ToDoItem.HIGH_PRIORITY)); p.add(new PriorityNode(MEDIUM, ToDoItem.MED_PRIORITY)); p.add(new PriorityNode(LOW, ToDoItem.LOW_PRIORITY)); /* Correct lazy initialization of static field * without further updates: */ priorities = p; } return priorities; } /** * @return the name */ public String getName() { return name; } /** * @return the priority */ public int getPriority() { return priority; } /* * @see java.lang.Object#toString() */ @Override public String toString() { return getName(); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.122+48.8
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.1399.894−46.196
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.037−7.556

Intercept 8.87 + feature contributions = 3.917 (log-odds).
Score = sigmoid(3.917) = 0.98.

Score0.911

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.123−3.319
Indentation frequencyHow rapidly indentation changes from line to line.70+1.684
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.121.975+1.295
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.029+0.659
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.73.707+0.385
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.976+0.362

Intercept 0.07 + feature contributions = 1.535 (log-odds).
Score = sigmoid(1.535) = 0.823.

Score0.634
Score23
Run 1

The code is highly readable with clear structure and organization. It follows standard Java conventions, separates constants, fields, constructor, and methods logically. Nesting is minimal, with only a lazy initialization block, and that block is small and well-commented. The intent of each method is obvious from its name and Javadoc, and all methods are short and single-purpose. Action granularity is mostly one statement per line, except for slightly compact object creation calls. Reading flow is natural and linear. The only minor deductions are for the long license header and the constructor's lack of 'this.' prefix, which could slightly improve clarity, but these do not significantly impact readability.

Run 2

The code is highly readable. It has a clear, logical class structure with well-separated fields, constructor, and methods. Nesting is minimal—only a single if block for lazy initialization. Intent is obvious: represent a priority level. Code length is concise and appropriate for the problem. Action granularity is mostly one action per line, though constructor assignments share lines. Reading flow is natural: constants, then constructor, then static accessor, then getters, then toString override. Well-written Javadoc comments explain each method’s purpose. Minor deductions: constructor assignments on the same line slightly reduce granularity, and the lazy initialization pattern could be slightly clearer. Overall, the code is easy to scan, understand, and maintain.

Run 3

The code is generally readable. It has clear class structure with well-named methods and fields. Nesting is minimal—only one level in the lazy initialization block. The intent is clear: a priority node with a cached list of priorities. Lines are concise, with one action per line, and reading flow is natural from fields to constructor, methods, and toString. However, the lengthy copyright header (not code) slightly interrupts readability at the top, and the lazy initialization block could be simplified, but these are minor. Overall, it is well-organized and maintainable.

Run 1

Code Structure: Constants, fields, constructor, initialization method, and accessors are logically organized. Nesting: Only one shallow conditional makes control flow easy to follow. Clarity of intent: Class documentation, descriptive method names, and named priority constants clearly communicate purpose, although abbreviated variables n, pri, and p are less expressive. Code length: Implementation is concise; extensive license text and repetitive accessor documentation add scanning overhead. Action granularity: Statements generally perform one action per line, with clear separation between list creation, population, and assignment. Reading flow: Methods follow a natural sequence, but inconsistent indentation, extra blank lines, and unnecessary line wrapping slightly disrupt the presentation.

Run 2

Code Structure: Fields, constructor, initialization method, and accessors are logically organized with clear separation. Nesting: Only one conditional level makes the logic easy to follow. Clarity of intent: Class documentation, descriptive constants, and straightforward methods communicate purpose well; abbreviated names n, pri, and p slightly reduce clarity. Code length: Implementation is concise, though the lengthy license header and routine accessor comments add scanning overhead. Action granularity: Each statement performs a single action, with no compressed multi-action lines. Reading flow: Conventional Java organization supports natural reading, but mixed indentation, extra blank lines, and unnecessary wrapping of short constructor calls slightly interrupt it.

Run 3

Code Structure: Fields, constructor, initialization method, getters, and toString are logically organized and clearly separated. Nesting: Only one conditional level makes control flow easy to follow. Clarity of intent: Descriptive class, constant, and method names communicate the purpose well; abbreviated variables n, pri, and p are less expressive. The comment claiming correct lazy initialization is potentially misleading because initialization is not synchronized. Code length: Implementation is concise, although extensive license headers and routine documentation increase scanning effort. Action granularity: Each statement performs a single action, with no dense compound expressions. Reading flow: Conventional Java organization supports natural reading, but mixed indentation, extra blank lines, and unnecessary wrapping of short constructor calls introduce minor visual friction.