HotSpot.java

Index Score
weka.associations
Weka

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
DECL_COMMENTSComments in declarations
EXEC_COMMENTSComments in executable code
SIZESize of the file in bytes
COMPARISONSNumber of comparison operators
LOGICAL_LINESNumber of statements
BLOCKSNumber of blocks
CYCLOMATICCyclomatic complexity
ELOCEffective lines of code
LINE_COMMENTNumber of line comments
LINESNumber of lines in the source file
LOOPSNumber of loops
OPERATORSNumber of operators
PROGRAM_LENGTHHalstead program length
OPERANDSNumber of operands
LOCLines of code
DOC_COMMENTNumber of javadoc comment lines
COMMENTSComment lines
UNIQUE_OPERANDSNumber of unique operands
PROGRAM_VOCABHalstead program vocabulary
JAVA0049JAVA0049 Nested block at depth N (maximum: M)
EXITSProcedure exits
FUNCTIONSNumber of function declarations
RETURNSNumber of return points from functions
JAVA0078JAVA0078 Floating point values compared with ==
INTERFACE_COMPLEXITYInterface complexity
JAVA0233JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0128JAVA0128 Public constructor in non-public class
JAVA0034JAVA0034 Missing braces in if statement
JAVA0007JAVA0007 Should not declare public field
JAVA0116JAVA0116 Missing javadoc: field 'field'
PARAMSNumber of formal parameter declarations
JAVA0174JAVA0174 Assigned local variable never used
WHITESPACENumber of whitespace lines
UNIQUE_OPERATORSNumber of unique operators
JAVA0076JAVA0076 Use of magic number
JAVA0096JAVA0096 Field in nested class hides outer field
NEST_DEPTHMaximum nesting depth
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0171JAVA0171 Unused local variable
JAVA0265JAVA0265 Use of Throwable.printStackTrace()
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0267JAVA0267 Use of System.err
JAVA0270JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0145JAVA0145 Tab character used in source file
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * alo0ng with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * HotSpot.java * Copyright (C) 2008 Pentaho Corporation * */ package weka.associations; import java.util.PriorityQueue; import java.util.HashMap; import java.util.ArrayList; import java.util.Vector; import java.util.Enumeration; import java.io.Serializable; import weka.core.Instances; import weka.core.Instance; import weka.core.Attribute; import weka.core.Utils; import weka.core.OptionHandler; import weka.core.Option; import weka.core.SingleIndex; import weka.core.Drawable; import weka.core.Capabilities.Capability; import weka.core.Capabilities; import weka.core.CapabilitiesHandler; import weka.core.RevisionHandler; import weka.core.RevisionUtils; /** <!-- globalinfo-start --> * HotSpot learns a set of rules (displayed in a tree-like structure) that maximize/minimize a target variable/value of interest. With a nominal target, one might want to look for segments of the data where there is a high probability of a minority value occuring (given the constraint of a minimum support). For a numeric target, one might be interested in finding segments where this is higher on average than in the whole data set. For example, in a health insurance scenario, find which health insurance groups are at the highest risk (have the highest claim ratio), or, which groups have the highest average insurance payout. * <p/> <!-- globalinfo-end --> * <!-- options-start --> * Valid options are: <p/> * * <pre> -c &lt;num | first | last&gt; * The target index. (default = last)</pre> * * <pre> -V &lt;num | first | last&gt; * The target value (nominal target only, default = first)</pre> * * <pre> -L * Minimize rather than maximize.</pre> * * <pre> -S &lt;num&gt; * Minimum value count (nominal target)/segment size (numeric target). * Values between 0 and 1 are * interpreted as a percentage of * the total population; values &gt; 1 are * interpreted as an absolute number of * instances (default = 0.3)</pre> * * <pre> -M &lt;num&gt; * Maximum branching factor (default = 2)</pre> * * <pre> -I &lt;num&gt; * Minimum improvement in target value in order * to add a new branch/test (default = 0.01 (1%))</pre> * * <pre> -D * Output debugging info (duplicate rule lookup * hash table stats)</pre> * <!-- options-end --> * * @author Mark Hall (mhall{[at]}pentaho{[dot]}org * @version $Revision: 1.6 $ */ public class HotSpot implements Associator, OptionHandler, RevisionHandler, CapabilitiesHandler, Drawable, Serializable { static final long serialVersionUID = 42972325096347677L; /** index of the target attribute */ protected SingleIndex m_targetSI = new SingleIndex("last"); protected int m_target; /** Support as a fraction of the total training set */ protected double m_support; /** Support as an instance count */ private int m_supportCount; /** The global value of the attribute of interest (mean or probability) */ protected double m_globalTarget; /** The minimum improvement necessary to justify adding a test */ protected double m_minImprovement; /** Actual global support of the target value (discrete target only) */ protected int m_globalSupport; /** For discrete target, the index of the value of interest */ protected SingleIndex m_targetIndexSI = new SingleIndex("first"); protected int m_targetIndex; /** At each level of the tree consider at most this number extensions */ protected int m_maxBranchingFactor; /** Number of instances in the full data */ protected int m_numInstances; /** The head of the tree */ protected HotNode m_head; /** Header of the training data */ protected Instances m_header; /** Debugging stuff */ protected int m_lookups = 0; protected int m_insertions = 0; protected int m_hits = 0; protected boolean m_debug; /** Minimize, rather than maximize the target */ protected boolean m_minimize; /** Error messages relating to too large/small support values */ protected String m_errorMessage; /** Rule lookup table */ protected HashMap<HotSpotHashKey, String> m_ruleLookup; /** * Constructor */ public HotSpot() { resetOptions(); } /** * Returns a string describing this classifier * @return a description of the classifier suitable for * displaying in the explorer/experimenter gui */ public String globalInfo() { return "HotSpot learns a set of rules (displayed in a tree-like structure) " + "that maximize/minimize a target variable/value of interest. " + "With a nominal target, one might want to look for segments of the " + "data where there is a high probability of a minority value occuring (" + "given the constraint of a minimum support). For a numeric target, " + "one might be interested in finding segments where this is higher " + "on average than in the whole data set. For example, in a health " + "insurance scenario, find which health insurance groups are at " + "the highest risk (have the highest claim ratio), or, which groups " + "have the highest average insurance payout."; } /** * Returns default capabilities of HotSpot * * @return the capabilities of HotSpot */ public Capabilities getCapabilities() { Capabilities result = new Capabilities(this); // attributes result.enable(Capability.NOMINAL_ATTRIBUTES); result.enable(Capability.NUMERIC_ATTRIBUTES); result.enable(Capability.MISSING_VALUES); // class result.enable(Capability.NUMERIC_CLASS); result.enable(Capability.NOMINAL_CLASS); return result; } /** * Hash key class for sets of attribute, value tests */ protected class HotSpotHashKey { // split values, one for each attribute (0 indicates att not used). // for nominal indexes, 1 is added so that 0 can indicate not used. protected double[] m_splitValues; // 0 = not used, 1 = "<=", 2 = "=", 3 = ">" protected byte[] m_testTypes; protected boolean m_computed = false; protected int m_key; public HotSpotHashKey(double[] splitValues, byte[] testTypes) { m_splitValues = splitValues.clone(); m_testTypes = testTypes.clone(); } public boolean equals(Object b) { if ((b == null) || !(b.getClass().equals(this.getClass()))) { return false; } HotSpotHashKey comp = (HotSpotHashKey)b; boolean ok = true; for (int i = 0; i < m_splitValues.length; i++) { if (m_splitValues[i] != comp.m_splitValues[i] || m_testTypes[i] != comp.m_testTypes[i]) { ok = false; break; } } return ok; } public int hashCode() { if (m_computed) { return m_key; } else { int hv = 0; for (int i = 0; i < m_splitValues.length; i++) { hv += (m_splitValues[i] * 5 * i); hv += (m_testTypes[i] * i * 3); } m_computed = true; m_key = hv; } return m_key; } } /** * Build the tree * * @param instances the training instances * @throws Exception if something goes wrong */ public void buildAssociations(Instances instances) throws Exception { m_errorMessage = null; m_targetSI.setUpper(instances.numAttributes() - 1); m_target = m_targetSI.getIndex(); Instances inst = new Instances(instances); inst.setClassIndex(m_target); inst.deleteWithMissingClass(); // can associator handle the data? getCapabilities().testWithFail(inst); if (inst.attribute(m_target).isNominal()) { m_targetIndexSI.setUpper(inst.attribute(m_target).numValues() - 1); m_targetIndex = m_targetIndexSI.getIndex(); } else { m_targetIndexSI.setUpper(1); // just to stop this SingleIndex from moaning } if (m_support <= 0) { throw new Exception("Support must be greater than zero."); } m_numInstances = inst.numInstances(); if (m_support >= 1) { m_supportCount = (int)m_support; m_support = m_support / (double)m_numInstances; } m_supportCount = (int)Math.floor((m_support * m_numInstances) + 0.5d); // m_supportCount = (int)(m_support * m_numInstances); if (m_supportCount < 1) { m_supportCount = 1; } m_header = new Instances(inst, 0); if (inst.attribute(m_target).isNumeric()) { if (m_supportCount > m_numInstances) { m_errorMessage = "Error: support set to more instances than there are in the data!"; return; } m_globalTarget = inst.meanOrMode(m_target); } else { double[] probs = new double[inst.attributeStats(m_target).nominalCounts.length]; for (int i = 0; i < probs.length; i++) { probs[i] = (double)inst.attributeStats(m_target).nominalCounts[i]; } m_globalSupport = (int)probs[m_targetIndex]; // check that global support is greater than min support if (m_globalSupport < m_supportCount) { m_errorMessage = "Error: minimum support " + m_supportCount + " is too high. Target value " + m_header.attribute(m_target).value(m_targetIndex) + " has support " + m_globalSupport + "."; } Utils.normalize(probs); m_globalTarget = probs[m_targetIndex]; /* System.err.println("Global target " + m_globalTarget); System.err.println("Min support count " + m_supportCount); */ } m_ruleLookup = new HashMap<HotSpotHashKey, String>(); double[] splitVals = new double[m_header.numAttributes()]; byte[] tests = new byte[m_header.numAttributes()]; m_head = new HotNode(inst, m_globalTarget, splitVals, tests); // m_head = new HotNode(inst, m_globalTarget); } /** * Return the tree as a string * * @return a String containing the tree */ public String toString() { StringBuffer buff = new StringBuffer(); buff.append("\nHot Spot\n========"); if (m_errorMessage != null) { buff.append("\n\n" + m_errorMessage + "\n\n"); return buff.toString(); } if (m_head == null) { buff.append("No model built!"); return buff.toString(); } buff.append("\nTotal population: "); buff.append("" + m_numInstances + " instances"); buff.append("\nTarget attribute: " + m_header.attribute(m_target).name()); if (m_header.attribute(m_target).isNominal()) { buff.append("\nTarget value: " + m_header.attribute(m_target).value(m_targetIndex)); buff.append(" [value count in total population: " + m_globalSupport + " instances (" + Utils.doubleToString((m_globalTarget * 100.0), 2) + "%)]"); buff.append("\nMinimum value count for segments: "); } else { buff.append("\nMinimum segment size: "); } buff.append("" + m_supportCount + " instances (" + Utils.doubleToString((m_support * 100.0), 2) + "% of total population)"); buff.append("\nMaximum branching factor: " + m_maxBranchingFactor); buff.append("\nMinimum improvement in target: " + Utils.doubleToString((m_minImprovement * 100.0), 2) + "%"); buff.append("\n\n"); buff.append(m_header.attribute(m_target).name()); if (m_header.attribute(m_target).isNumeric()) { buff.append(" (" + Utils.doubleToString(m_globalTarget, 4) + ")"); } else { buff.append("=" + m_header.attribute(m_target).value(m_targetIndex) + " ("); buff.append("" + Utils.doubleToString((m_globalTarget * 100.0), 2) + "% ["); buff.append("" + m_globalSupport + "/" + m_numInstances + "])"); } m_head.dumpTree(0, buff); buff.append("\n"); if (m_debug) { buff.append("\n=== Duplicate rule lookup hashtable stats ===\n"); buff.append("Insertions: "+ m_insertions); buff.append("\nLookups : "+ m_lookups); buff.append("\nHits: "+ m_hits); buff.append("\n"); } return buff.toString(); } public String graph() throws Exception { System.err.println("Here"); m_head.assignIDs(-1); StringBuffer text = new StringBuffer(); text.append("digraph HotSpot {\n"); text.append("rankdir=LR;\n"); text.append("N0 [label=\"" + m_header.attribute(m_target).name()); if (m_header.attribute(m_target).isNumeric()) { text.append("\\n(" + Utils.doubleToString(m_globalTarget, 4) + ")"); } else { text.append("=" + m_header.attribute(m_target).value(m_targetIndex) + "\\n("); text.append("" + Utils.doubleToString((m_globalTarget * 100.0), 2) + "% ["); text.append("" + m_globalSupport + "/" + m_numInstances + "])"); } text.append("\" shape=plaintext]\n"); m_head.graphHotSpot(text); text.append("}\n"); return text.toString(); } /** * Inner class representing a node/leaf in the tree */ protected class HotNode implements Serializable { /** * An inner class holding data on a particular attribute value test */ protected class HotTestDetails implements Comparable<HotTestDetails>, Serializable { public double m_merit; public int m_support; public int m_subsetSize; public int m_splitAttIndex; public double m_splitValue; public boolean m_lessThan; public HotTestDetails(int attIndex, double splitVal, boolean lessThan, int support, int subsetSize, double merit) { m_merit = merit; m_splitAttIndex = attIndex; m_splitValue = splitVal; m_lessThan = lessThan; m_support = support; m_subsetSize = subsetSize; } // reverse order for maximize as PriorityQueue has the least element at the head public int compareTo(HotTestDetails comp) { int result = 0; if (m_minimize) { if (m_merit == comp.m_merit) { // larger support is better if (m_support == comp.m_support) { } else if (m_support > comp.m_support) { result = -1; } else { result = 1; } } else if (m_merit < comp.m_merit) { result = -1; } else { result = 1; } } else { if (m_merit == comp.m_merit) { // larger support is better if (m_support == comp.m_support) { } else if (m_support > comp.m_support) { result = -1; } else { result = 1; } } else if (m_merit < comp.m_merit) { result = 1; } else { result = -1; } } return result; } } // the instances at this node protected Instances m_insts; // the value (to beat) of the target for these instances protected double m_targetValue; // child nodes protected HotNode[] m_children; protected HotTestDetails[] m_testDetails; public int m_id; /** * Constructor * * @param insts the instances at this node * @param targetValue the target value * @param splitVals the values of attributes split on so far down this branch * @param tests the types of tests corresponding to the split values (<=, =, >) */ public HotNode(Instances insts, double targetValue, double[] splitVals, byte[] tests) { m_insts = insts; m_targetValue = targetValue; PriorityQueue<HotTestDetails> splitQueue = new PriorityQueue<HotTestDetails>(); // Consider each attribute for (int i = 0; i < m_insts.numAttributes(); i++) { if (i != m_target) { if (m_insts.attribute(i).isNominal()) { evaluateNominal(i, splitQueue); } else { evaluateNumeric(i, splitQueue); } } } if (splitQueue.size() > 0) { int queueSize = splitQueue.size(); // count how many of the potential children are unique ArrayList<HotTestDetails> newCandidates = new ArrayList<HotTestDetails>(); ArrayList<HotSpotHashKey> keyList = new ArrayList<HotSpotHashKey>(); for (int i = 0; i < queueSize; i++) { if (newCandidates.size() < m_maxBranchingFactor) { HotTestDetails temp = splitQueue.poll(); double[] newSplitVals = splitVals.clone(); byte[] newTests = tests.clone(); newSplitVals[temp.m_splitAttIndex] = temp.m_splitValue + 1; newTests[temp.m_splitAttIndex] = (m_header.attribute(temp.m_splitAttIndex).isNominal()) ? (byte)2 // == : (temp.m_lessThan) ? (byte)1 : (byte)3; HotSpotHashKey key = new HotSpotHashKey(newSplitVals, newTests); m_lookups++; if (!m_ruleLookup.containsKey(key)) { // insert it into the hash table m_ruleLookup.put(key, ""); newCandidates.add(temp); keyList.add(key); m_insertions++; } else { m_hits++; } } else { break; } } m_children = new HotNode[(newCandidates.size() < m_maxBranchingFactor) ? newCandidates.size() : m_maxBranchingFactor]; // save the details of the tests at this node m_testDetails = new HotTestDetails[m_children.length]; for (int i = 0; i < m_children.length; i++) { m_testDetails[i] = newCandidates.get(i); } // save memory splitQueue = null; newCandidates = null; m_insts = new Instances(m_insts, 0); // process the children for (int i = 0; i < m_children.length; i++) { Instances subset = subset(insts, m_testDetails[i]); HotSpotHashKey tempKey = keyList.get(i); m_children[i] = new HotNode(subset, m_testDetails[i].m_merit, tempKey.m_splitValues, tempKey.m_testTypes); } } } /** * Create a subset of instances that correspond to the supplied test details * * @param insts the instances to create the subset from * @param test the details of the split */ private Instances subset(Instances insts, HotTestDetails test) { Instances sub = new Instances(insts, insts.numInstances()); for (int i = 0; i < insts.numInstances(); i++) { Instance temp = insts.instance(i); if (!temp.isMissing(test.m_splitAttIndex)) { if (insts.attribute(test.m_splitAttIndex).isNominal()) { if (temp.value(test.m_splitAttIndex) == test.m_splitValue) { sub.add(temp); } } else { if (test.m_lessThan) { if (temp.value(test.m_splitAttIndex) <= test.m_splitValue) { sub.add(temp); } } else { if (temp.value(test.m_splitAttIndex) > test.m_splitValue) { sub.add(temp); } } } } } sub.compactify(); return sub; } /** * Evaluate a numeric attribute for a potential split * * @param attIndex the index of the attribute * @param pq the priority queue of candidtate splits */ private void evaluateNumeric(int attIndex, PriorityQueue<HotTestDetails> pq) { Instances tempInsts = m_insts; tempInsts.sort(attIndex); // target sums/counts double targetLeft = 0; double targetRight = 0; int numMissing = 0; // count missing values and sum/counts for the initial right subset for (int i = tempInsts.numInstances() - 1; i >= 0; i--) { if (!tempInsts.instance(i).isMissing(attIndex)) { targetRight += (tempInsts.attribute(m_target).isNumeric()) ? (tempInsts.instance(i).value(m_target)) : ((tempInsts.instance(i).value(m_target) == m_targetIndex) ? 1 : 0); } else { numMissing++; } } // are there still enough instances? if (tempInsts.numInstances() - numMissing <= m_supportCount) { return; } double bestMerit = 0.0; double bestSplit = 0.0; double bestSupport = 0.0; double bestSubsetSize = 0; boolean lessThan = true; // denominators double leftCount = 0; double rightCount = tempInsts.numInstances() - numMissing; /* targetRight = (tempInsts.attribute(m_target).isNumeric()) ? tempInsts.attributeStats(m_target).numericStats.sum : tempInsts.attributeStats(m_target).nominalCounts[m_targetIndex]; */ // targetRight = tempInsts.attributeStats(attIndexnominalCounts[m_targetIndex]; // consider all splits for (int i = 0; i < tempInsts.numInstances() - numMissing; i++) { Instance inst = tempInsts.instance(i); if (tempInsts.attribute(m_target).isNumeric()) { targetLeft += inst.value(m_target); targetRight -= inst.value(m_target); } else { if ((int)inst.value(m_target) == m_targetIndex) { targetLeft++; targetRight--; } } leftCount++; rightCount--; // move to the end of any ties if (i < tempInsts.numInstances() - 1 && inst.value(attIndex) == tempInsts.instance(i + 1).value(attIndex)) { continue; } // evaluate split if (tempInsts.attribute(m_target).isNominal()) { if (targetLeft >= m_supportCount) { double delta = (m_minimize) ? (bestMerit - (targetLeft / leftCount)) : ((targetLeft / leftCount) - bestMerit); // if (targetLeft / leftCount > bestMerit) { if (delta > 0) { bestMerit = targetLeft / leftCount; bestSplit = inst.value(attIndex); bestSupport = targetLeft; bestSubsetSize = leftCount; lessThan = true; // } else if (targetLeft / leftCount == bestMerit) { } else if (delta == 0) { // break ties in favour of higher support if (targetLeft > bestSupport) { bestMerit = targetLeft / leftCount; bestSplit = inst.value(attIndex); bestSupport = targetLeft; bestSubsetSize = leftCount; lessThan = true; } } } if (targetRight >= m_supportCount) { double delta = (m_minimize) ? (bestMerit - (targetRight / rightCount)) : ((targetRight / rightCount) - bestMerit); // if (targetRight / rightCount > bestMerit) { if (delta > 0) { bestMerit = targetRight / rightCount; bestSplit = inst.value(attIndex); bestSupport = targetRight; bestSubsetSize = rightCount; lessThan = false; // } else if (targetRight / rightCount == bestMerit) { } else if (delta == 0) { // break ties in favour of higher support if (targetRight > bestSupport) { bestMerit = targetRight / rightCount; bestSplit = inst.value(attIndex); bestSupport = targetRight; bestSubsetSize = rightCount; lessThan = false; } } } } else { if (leftCount >= m_supportCount) { double delta = (m_minimize) ? (bestMerit - (targetLeft / leftCount)) : ((targetLeft / leftCount) - bestMerit); // if (targetLeft / leftCount > bestMerit) { if (delta > 0) { bestMerit = targetLeft / leftCount; bestSplit = inst.value(attIndex); bestSupport = leftCount; bestSubsetSize = leftCount; lessThan = true; // } else if (targetLeft / leftCount == bestMerit) { } else if (delta == 0) { // break ties in favour of higher support if (leftCount > bestSupport) { bestMerit = targetLeft / leftCount; bestSplit = inst.value(attIndex); bestSupport = leftCount; bestSubsetSize = leftCount; lessThan = true; } } } if (rightCount >= m_supportCount) { double delta = (m_minimize) ? (bestMerit - (targetRight / rightCount)) : ((targetRight / rightCount) - bestMerit); // if (targetRight / rightCount > bestMerit) { if (delta > 0) { bestMerit = targetRight / rightCount; bestSplit = inst.value(attIndex); bestSupport = rightCount; bestSubsetSize = rightCount; lessThan = false; // } else if (targetRight / rightCount == bestMerit) { } else if (delta == 0) { // break ties in favour of higher support if (rightCount > bestSupport) { bestMerit = targetRight / rightCount; bestSplit = inst.value(attIndex); bestSupport = rightCount; bestSubsetSize = rightCount; lessThan = false; } } } } } double delta = (m_minimize) ? m_targetValue - bestMerit : bestMerit - m_targetValue; // Have we found a candidate split? if (bestSupport > 0 && (delta / m_targetValue >= m_minImprovement)) { /* System.err.println("Evaluating " + tempInsts.attribute(attIndex).name()); System.err.println("Merit : " + bestMerit); System.err.println("Support : " + bestSupport); */ // double suppFraction = bestSupport / m_numInstances; HotTestDetails newD = new HotTestDetails(attIndex, bestSplit, lessThan, (int)bestSupport, (int)bestSubsetSize, bestMerit); pq.add(newD); } } /** * Evaluate a nominal attribute for a potential split * * @param attIndex the index of the attribute * @param pq the priority queue of candidtate splits */ private void evaluateNominal(int attIndex, PriorityQueue<HotTestDetails> pq) { int[] counts = m_insts.attributeStats(attIndex).nominalCounts; boolean ok = false; // only consider attribute values that result in subsets that meet/exceed min support for (int i = 0; i < m_insts.attribute(attIndex).numValues(); i++) { if (counts[i] >= m_supportCount) { ok = true; break; } } if (ok) { double[] subsetMerit = new double[m_insts.attribute(attIndex).numValues()]; for (int i = 0; i < m_insts.numInstances(); i++) { Instance temp = m_insts.instance(i); if (!temp.isMissing(attIndex)) { int attVal = (int)temp.value(attIndex); if (m_insts.attribute(m_target).isNumeric()) { subsetMerit[attVal] += temp.value(m_target); } else { subsetMerit[attVal] += ((int)temp.value(m_target) == m_targetIndex) ? 1.0 : 0; } } } // add to queue if it meets min support and exceeds the merit for the full set for (int i = 0; i < m_insts.attribute(attIndex).numValues(); i++) { // does the subset based on this value have enough instances, and, furthermore, // does the target value (nominal only) occur enough times to exceed min support if (counts[i] >= m_supportCount && ((m_insts.attribute(m_target).isNominal()) ? (subsetMerit[i] >= m_supportCount) // nominal only test : true)) { double merit = subsetMerit[i] / counts[i]; //subsetMerit[i][1]; double delta = (m_minimize) ? m_targetValue - merit : merit - m_targetValue; if (delta / m_targetValue >= m_minImprovement) { double support = (m_insts.attribute(m_target).isNominal()) ? subsetMerit[i] : counts[i]; HotTestDetails newD = new HotTestDetails(attIndex, (double)i, false, (int)support, counts[i], merit); pq.add(newD); } } } } } public int assignIDs(int lastID) { int currentLastID = lastID + 1; m_id = currentLastID; if (m_children != null) { for (int i = 0; i < m_children.length; i++) { currentLastID = m_children[i].assignIDs(currentLastID); } } return currentLastID; } private void addNodeDetails(StringBuffer buff, int i, String spacer) { buff.append(m_header.attribute(m_testDetails[i].m_splitAttIndex).name()); if (m_header.attribute(m_testDetails[i].m_splitAttIndex).isNumeric()) { if (m_testDetails[i].m_lessThan) { buff.append(" <= "); } else { buff.append(" > "); } buff.append(Utils.doubleToString(m_testDetails[i].m_splitValue, 4)); } else { buff.append(" = " + m_header. attribute(m_testDetails[i].m_splitAttIndex). value((int)m_testDetails[i].m_splitValue)); } if (m_header.attribute(m_target).isNumeric()) { buff.append(spacer + "(" + Utils.doubleToString(m_testDetails[i].m_merit, 4) + " [" + m_testDetails[i].m_support + "])"); } else { buff.append(spacer + "(" + Utils.doubleToString((m_testDetails[i].m_merit * 100.0), 2) + "% [" + m_testDetails[i].m_support + "/" + m_testDetails[i].m_subsetSize + "])"); } } private void graphHotSpot(StringBuffer text) { if (m_children != null) { for (int i = 0; i < m_children.length; i++) { text.append("N" + m_children[i].m_id); text.append(" [label=\""); addNodeDetails(text, i, "\\n"); text.append("\" shape=plaintext]\n"); m_children[i].graphHotSpot(text); text.append("N" + m_id + "->" + "N" + m_children[i].m_id + "\n"); } } } /** * Traverse the tree to create a string description * * @param depth the depth at this point in the tree * @param buff the string buffer to append node details to */ protected void dumpTree(int depth, StringBuffer buff) { if (m_children == null) { // buff.append("\n"); } else { for (int i = 0; i < m_children.length; i++) { buff.append("\n "); for (int j = 0; j < depth; j++) { buff.append("| "); } addNodeDetails(buff, i, " "); m_children[i].dumpTree(depth + 1, buff); } } } } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String targetTipText() { return "The target attribute of interest."; } /** * Set the target index * * @param target the target index as a string (1-based) */ public void setTarget(String target) { m_targetSI.setSingleIndex(target); } /** * Get the target index as a string * * @return the target index (1-based) */ public String getTarget() { return m_targetSI.getSingleIndex(); } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String targetIndexTipText() { return "The value of the target (nominal attributes only) of interest."; } /** * For a nominal target, set the index of the value of interest (1-based) * * @param index the index of the nominal value of interest */ public void setTargetIndex(String index) { m_targetIndexSI.setSingleIndex(index); } /** * For a nominal target, get the index of the value of interest (1-based) * * @return the index of the nominal value of interest */ public String getTargetIndex() { return m_targetIndexSI.getSingleIndex(); } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String minimizeTargetTipText() { return "Minimize rather than maximize the target."; } /** * Set whether to minimize the target rather than maximize * * @param m true if target is to be minimized */ public void setMinimizeTarget(boolean m) { m_minimize = m; } /** * Get whether to minimize the target rather than maximize * * @return true if target is to be minimized */ public boolean getMinimizeTarget() { return m_minimize; } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String supportTipText() { return "The minimum support. Values between 0 and 1 are interpreted " + "as a percentage of the total population; values > 1 are " + "interpreted as an absolute number of instances"; } /** * Get the minimum support * * @return the minimum support */ public double getSupport() { return m_support; } /** * Set the minimum support * * @param s the minimum support */ public void setSupport(double s) { m_support = s; } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String maxBranchingFactorTipText() { return "Maximum branching factor. The maximum number of children " + "to consider extending each node with."; } /** * Set the maximum branching factor * * @param b the maximum branching factor */ public void setMaxBranchingFactor(int b) { m_maxBranchingFactor = b; } /** * Get the maximum branching factor * * @return the maximum branching factor */ public int getMaxBranchingFactor() { return m_maxBranchingFactor; } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String minImprovementTipText() { return "Minimum improvement in target value in order to " + "consider adding a new branch/test"; } /** * Set the minimum improvement in the target necessary to add a test * * @param i the minimum improvement */ public void setMinImprovement(double i) { m_minImprovement = i; } /** * Get the minimum improvement in the target necessary to add a test * * @return the minimum improvement */ public double getMinImprovement() { return m_minImprovement; } /** * Returns the tip text for this property * @return tip text for this property suitable for * displaying in the explorer/experimenter gui */ public String debugTipText() { return "Output debugging info (duplicate rule lookup hash table stats)."; } /** * Set whether debugging info is output * * @param d true to output debugging info */ public void setDebug(boolean d) { m_debug = d; } /** * Get whether debugging info is output * * @return true if outputing debugging info */ public boolean getDebug() { return m_debug; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration listOptions() { Vector newVector = new Vector(); newVector.addElement(new Option("\tThe target index. (default = last)", "c", 1, "-c <num | first | last>")); newVector.addElement(new Option("\tThe target value (nominal target only, default = first)", "V", 1, "-V <num | first | last>")); newVector.addElement(new Option("\tMinimize rather than maximize.", "L", 0, "-L")); newVector.addElement(new Option("\tMinimum value count (nominal target)/segment size " + "(numeric target)." +"\n\tValues between 0 and 1 are " + "\n\tinterpreted as a percentage of " + "\n\tthe total population; values > 1 are " + "\n\tinterpreted as an absolute number of " +"\n\tinstances (default = 0.3)", "-S", 1, "-S <num>")); newVector.addElement(new Option("\tMaximum branching factor (default = 2)", "-M", 1, "-M <num>")); newVector.addElement(new Option("\tMinimum improvement in target value in order " + "\n\tto add a new branch/test (default = 0.01 (1%))", "-I", 1, "-I <num>")); newVector.addElement(new Option("\tOutput debugging info (duplicate rule lookup " + "\n\thash table stats)", "-D", 0, "-D")); return newVector.elements(); } /** * Reset options to their defaults */ public void resetOptions() { m_support = 0.33; m_minImprovement = 0.01; // 1% m_maxBranchingFactor = 2; m_minimize = false; m_debug = false; setTarget("last"); setTargetIndex("first"); m_errorMessage = null; } /** * Parses a given list of options. <p/> * <!-- options-start --> * Valid options are: <p/> * * <pre> -c &lt;num | first | last&gt; * The target index. (default = last)</pre> * * <pre> -V &lt;num | first | last&gt; * The target value (nominal target only, default = first)</pre> * * <pre> -L * Minimize rather than maximize.</pre> * * <pre> -S &lt;num&gt; * Minimum value count (nominal target)/segment size (numeric target). * Values between 0 and 1 are * interpreted as a percentage of * the total population; values &gt; 1 are * interpreted as an absolute number of * instances (default = 0.3)</pre> * * <pre> -M &lt;num&gt; * Maximum branching factor (default = 2)</pre> * * <pre> -I &lt;num&gt; * Minimum improvement in target value in order * to add a new branch/test (default = 0.01 (1%))</pre> * * <pre> -D * Output debugging info (duplicate rule lookup * hash table stats)</pre> * <!-- options-end --> * * @param options the list of options as an array of strings * @exception Exception if an option is not supported */ public void setOptions(String[] options) throws Exception { resetOptions(); String tempString = Utils.getOption('c', options); if (tempString.length() != 0) { setTarget(tempString); } tempString = Utils.getOption('V', options); if (tempString.length() != 0) { setTargetIndex(tempString); } setMinimizeTarget(Utils.getFlag('L', options)); tempString = Utils.getOption('S', options); if (tempString.length() != 0) { setSupport(Double.parseDouble(tempString)); } tempString = Utils.getOption('M', options); if (tempString.length() != 0) { setMaxBranchingFactor(Integer.parseInt(tempString)); } tempString = Utils.getOption('I', options); if (tempString.length() != 0) { setMinImprovement(Double.parseDouble(tempString)); } setDebug(Utils.getFlag('D', options)); } /** * Gets the current settings of HotSpot. * * @return an array of strings suitable for passing to setOptions */ public String [] getOptions() { String[] options = new String[12]; int current = 0; options[current++] = "-c"; options[current++] = getTarget(); options[current++] = "-V"; options[current++] = getTargetIndex(); if (getMinimizeTarget()) { options[current++] = "-L"; } options[current++] = "-S"; options[current++] = "" + getSupport(); options[current++] = "-M"; options[current++] = "" + getMaxBranchingFactor(); options[current++] = "-I"; options[current++] = "" + getMinImprovement(); if (getDebug()) { options[current++] = "-D"; } while (current < options.length) { options[current++] = ""; } return options; } /** * Returns the revision string. * * @return the revision */ public String getRevision() { return RevisionUtils.extract("$Revision: 1.6 $"); } /** * Returns the type of graph this scheme * represents. * @return Drawable.TREE */ public int graphType() { return Drawable.TREE; } /** * Main method for testing this class. * * @param args the options */ public static void main(String[] args) { try { HotSpot h = new HotSpot(); AbstractAssociator.runAssociator(new HotSpot(), args); } catch (Exception ex) { ex.printStackTrace(); } } }

The table below shows all metrics for HotSpot.java.

MetricValueDescription
BLOCKS169.00Number of blocks
BLOCK_COMMENT28.00Number of block comment lines
COMMENTS370.00Comment lines
COMMENT_DENSITY 0.57Comment density
COMPARISONS130.00Number of comparison operators
CYCLOMATIC163.00Cyclomatic complexity
DECL_COMMENTS65.00Comments in declarations
DOC_COMMENT294.00Number of javadoc comment lines
ELOC652.00Effective lines of code
EXEC_COMMENTS43.00Comments in executable code
EXITS80.00Procedure exits
FUNCTIONS47.00Number of function declarations
HALSTEAD_DIFFICULTY126.81Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY102.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 1.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 1.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 7.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA0034 0.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 6.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 0.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 6.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA007810.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 1.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 1.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 1.00JAVA0096 Field in nested class hides outer field
JAVA0098 2.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 1.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 0.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 1.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 0.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 7.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 3.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 3.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 1.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 1.00JAVA0144 Line exceeds maximum M characters
JAVA0145 2.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 0.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 1.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 1.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 2.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 0.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 1.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 2.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 0.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 0.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 1.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 1.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 1.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES1302.00Number of lines in the source file
LINE_COMMENT48.00Number of line comments
LOC792.00Lines of code
LOGICAL_LINES418.00Number of statements
LOOPS18.00Number of loops
NEST_DEPTH 6.00Maximum nesting depth
OPERANDS1805.00Number of operands
OPERATORS3405.00Number of operators
PARAMS37.00Number of formal parameter declarations
PROGRAM_LENGTH5210.00Halstead program length
PROGRAM_VOCAB487.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS65.00Number of return points from functions
SIZE43013.00Size of the file in bytes
UNIQUE_OPERANDS427.00Number of unique operands
UNIQUE_OPERATORS60.00Number of unique operators
WHITESPACE140.00Number of whitespace lines