GameMode.java

Index Score
pcgen.core
PCGen

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
FUNCTIONSNumber of function declarations
DOC_COMMENTNumber of javadoc comment lines
RETURNSNumber of return points from functions
COMMENTSComment lines
INTERFACE_COMPLEXITYInterface complexity
LINESNumber of lines in the source file
CYCLOMATICCyclomatic complexity
BLOCKSNumber of blocks
LOCLines of code
PARAMSNumber of formal parameter declarations
SIZESize of the file in bytes
OPERATORSNumber of operators
ELOCEffective lines of code
UNIQUE_OPERANDSNumber of unique operands
PROGRAM_LENGTHHalstead program length
LOGICAL_LINESNumber of statements
PROGRAM_VOCABHalstead program vocabulary
OPERANDSNumber of operands
COMPARISONSNumber of comparison operators
EXITSProcedure exits
WHITESPACENumber of whitespace lines
JAVA0145JAVA0145 Tab character used in source file
LINE_COMMENTNumber of line comments
LOOPSNumber of loops
JAVA0177JAVA0177 Variable declaration missing initializer
JAVA0259JAVA0259 Return of collection/array field
EXEC_COMMENTSComments in executable code
JAVA0117JAVA0117 Missing javadoc: method 'method'
JAVA0034JAVA0034 Missing braces in if statement
JAVA0076JAVA0076 Use of magic number
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0144JAVA0144 Line exceeds maximum M characters
JAVA0256JAVA0256 Assignment of external collection/array to field
UNIQUE_OPERATORSNumber of unique operators
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0174JAVA0174 Assigned local variable never used
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0179JAVA0179 Local variable hides visible field
JAVA0123JAVA0123 Use all three components of for loop
JAVA0007JAVA0007 Should not declare public field
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0130JAVA0130 Non-static method does not use instance fields
JAVA0075JAVA0075 Method parameter hides field
NEST_DEPTHMaximum nesting depth
/* * GameMode.java * Copyright 2001 (C) Greg Bingleman <byngl@hotmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Created on September 22, 2002, 4:30 PM * * Current Ver: $Revision: 7344 $ * Last Editor: $Author: thpr $ * Last Edited: $Date: 2008-08-04 19:55:57 -0400 (Mon, 04 Aug 2008) $ * */ package pcgen.core; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; import pcgen.cdom.base.CDOMObject; import pcgen.cdom.base.Constants; import pcgen.cdom.base.MasterListInterface; import pcgen.cdom.reference.TransparentReferenceManufacturer; import pcgen.core.character.WieldCategory; import pcgen.core.prereq.PrereqHandler; import pcgen.core.system.GameModeRollMethod; import pcgen.rules.context.ConsolidatedListCommitStrategy; import pcgen.rules.context.GameReferenceContext; import pcgen.rules.context.LoadContext; import pcgen.rules.context.ReferenceContext; import pcgen.rules.context.RuntimeLoadContext; import pcgen.util.ComparableComparator; import pcgen.util.Logging; import pcgen.util.PropertyFactory; import pcgen.util.enumeration.Tab; /** * Handles game modes. * * @author Greg Bingleman <byngl@hotmail.com> * @version $Revision: 7344 $ */ public final class GameMode implements Comparable<Object> { private static PObject eqSizePenalty = new PObject(); private List<String> allowedModes; private List<String> bonusFeatLevels = new ArrayList<String>(); private Map<String, String> bonusSpellMap = new HashMap<String, String>(); // key is level of bonus spell, value is "basestatscore|statrange" private List<String> bonusStackList = new ArrayList<String>(); private List<String> bonusStatLevels = new ArrayList<String>(); private List<ClassType> classTypeList = new ArrayList<ClassType>(); private List<String> defaultDataSetList = new ArrayList<String>(); private List<String> defaultDeityList = new ArrayList<String>(); private Map<String, Map<String, LevelInfo>> levelInfo = new HashMap<String, Map<String, LevelInfo>>(); private List<String> loadStrings = new ArrayList<String>(); private List<String> skillMultiplierLevels = new ArrayList<String>(); private List<String> wcStepsList = new ArrayList<String>(); private List<WieldCategory> wieldCategoryList = new ArrayList<WieldCategory>(); private Map<String, List<String>> ACTypeAddMap = new HashMap<String, List<String>>(); private Map<String, List<String>> ACTypeRemoveMap = new HashMap<String, List<String>>(); private Map<String, String> damageDownMap = new HashMap<String, String>(); private Map<String, String> damageUpMap = new HashMap<String, String>(); private Map<String, String> plusCalcs; private Map<String, String> spellRangeMap = new HashMap<String, String>(); private String acAbbrev = ""; private String acName = ""; private String alignmentName = ""; private String althpAbbrev = ""; private String althpName = ""; private String babAbbrev = null; private String currencyUnit = ""; private String currencyUnitAbbrev = ""; private String damageResistance = ""; private String defaultSpellBook = "Known Spells"; private String defaultUnitSet = Constants.s_STANDARD_UNITSET_NAME; private UnitSet selectedUnitSet = null; private String displayVariable2Name = ""; private String displayVariable2Text = ""; private String displayVariable3Name = ""; private String displayVariable3Text = ""; private String displayVariableName = ""; private String displayVariableText = ""; private String folderName = ""; private String hpAbbrev = ""; private String hpName = ""; private String levelUpMessage = ""; private String menuEntry = ""; private String menuToolTip = ""; private String name = ""; private String spellBaseDC = "0"; private String wcStepsFormula = ""; private String weaponCategories = ""; private String weaponTypes = ""; private String weaponReachFormula = ""; private String rankModFormula = ""; private String addWithMetamagic = ""; private SortedMap<String, RuleCheck> ruleCheckMap = new TreeMap<String, RuleCheck>(); private Map<Tab,TabInfo> tInfo = new HashMap<Tab,TabInfo>(); private boolean allowAutoResize = false; private boolean bonusStatAllowsStack = false; private boolean showClassDefense; private int babAttCyc = 5; //6 private int babMaxAtt = Integer.MAX_VALUE; //4 private int babMaxLvl = Integer.MAX_VALUE; //20 private int babMinVal = 1; private int checksMaxLvl = Integer.MAX_VALUE; //20 private int displayOrder = Integer.MAX_VALUE; private List<PCStat> statList = new ArrayList<PCStat>(); /** String array of Attributes in long format */ public String[] s_ATTRIBLONG; /** String array of Attributes in short format */ public String[] s_ATTRIBSHORT; private final List<PObject> checkList = new ArrayList<PObject>(); private final List<PCAlignment> alignmentList = new ArrayList<PCAlignment>(15); private final List<String> schoolsList = new ArrayList<String>(20); private int skillCosts_Class = 1; private int skillCost_CrossClass = 2; private int skillCost_Exclusive = 0; private String pointPoolName = ""; private String hpFormula = ""; private int nonProfPenalty = -4; private double squareSize = 5; /** no default distance for short range */ private int shortRangeDistance; private int rangePenalty; private List<GameModeRollMethod> rollingMethods = null; private int rollingMethodIndex = -1; private SortedMap<Integer, PointBuyCost> pointBuyStatCosts = null; private int[] abilityScoreCost = null; private List<PointBuyMethod> pointBuyMethods = null; private String purchaseMethodName = ""; //$NON-NLS-1$ private int rollMethod = Constants.CHARACTERSTATMETHOD_USER; private final List<SizeAdjustment> sizeAdjustmentList = new ArrayList<SizeAdjustment>(9); private final SizeAdjustment spareSize = new SizeAdjustment(); private int allStatsValue = 10; // // minimum and maximum stat values when creating new characters. // private int statMin = 3; private int statMax = 18; private TreeMap<Integer, String> statDisplayText = null; private String statDisplayTextAppend = "+"; private TreeMap<Integer, String> skillRankDisplayText = null; private boolean [] summaryTabStatColumnVisible = { true, true, true, true, true, true, true }; private boolean [] skillTabColumnVisible = { true, true, true, true, true, true, true }; // Skill, Modifier, Ranks, Total, Cost, Source, Order private List<AbilityCategory> theAbilityCategories = new ArrayList<AbilityCategory>(5); private List<AbilityCategory> theLstAbilityCategories = new ArrayList<AbilityCategory>(); private String thePreviewDir; private String theDefaultPreviewSheet; private int [] dieSizes; private int maxDieSize = 12; private int minDieSize = 4; private TimeUnit defaultTimeUnit; private List<TimeUnit> theTimeUnits = new ArrayList<TimeUnit>(); private List<String> resizableTypeList = new ArrayList<String>(); private Map<Class<?>, Set<String>> hiddenTypes = new HashMap<Class<?>, Set<String>>(); private List<String> xpTableNames = new ArrayList<String>(); private String currXpTableName; /** * Creates a new instance of GameMode. * * @param modeName the mode name */ public GameMode(final String modeName) { name = modeName; folderName = modeName; thePreviewDir = modeName; theDefaultPreviewSheet = "preview.html"; //$NON-NLS-1$ for (Tab aTab : Tab.values()) { TabInfo ti = new TabInfo(); ti.tabName = aTab.label(); tInfo.put(aTab, ti); } defaultTimeUnit = new TimeUnit("DAY", "Day"); theTimeUnits.add(defaultTimeUnit); } /** * Set the AC Abbreviation * @param aString */ public void setACAbbrev(final String aString) { acAbbrev = aString; } /** * Set the AC Text * @param aString */ public void setACText(final String aString) { acName = aString; } /** * Add the AC Type as a string to the List * @param ACType * @return List of AC Types */ public List<String> getACTypeAddString(final String ACType) { if (ACTypeAddMap == null) { return new ArrayList<String>(); } return ACTypeAddMap.get(ACType); } /** * Remove the AC Type as a string to the List * @param ACType * @return List of AC Types */ public List<String> getACTypeRemoveString(final String ACType) { if (ACTypeRemoveMap == null) { return new ArrayList<String>(); } return ACTypeRemoveMap.get(ACType); } /** * Set Alignment Text * @param aString */ public void setAlignmentText(final String aString) { alignmentName = aString; } /** * Set Allowed Game modes * @param argAllowedModes */ public void setAllowedModes(final String argAllowedModes) { final StringTokenizer aTok = new StringTokenizer(argAllowedModes, "|", false); while (aTok.hasMoreTokens()) { final String aString = aTok.nextToken(); if (allowedModes == null) { allowedModes = new ArrayList<String>(); } allowedModes.add(aString); } } /** * Set the alternative HP Abbreviation * @param aString */ public void setAltHPAbbrev(final String aString) { althpAbbrev = aString; } /** * Set the alternative HP Text * @param aString */ public void setAltHPText(final String aString) { althpName = aString; } /** * Set flag to allow auto resizing or not * @param allow */ public void setAllowAutoResize(final boolean allow) { allowAutoResize = allow; } /** * Get the allow auto resize flag * @return true if allowed to auto resize */ public boolean getAllowAutoResize() { return allowAutoResize; } /** * Set BAB Abbreviation * @param aString */ public void setBabAbbrev(final String aString) { babAbbrev = aString; } /** * Get BAB Abbreviation * @return BAB Abbreviation */ public String getBabAbbrev() { return babAbbrev; } /** * Set BAB Minimum value * @param arg */ public void setBabMinVal(final int arg) { babMinVal = arg; } /** * Get BAB Minimum value * @return BAB Minimum value */ public int getBabMinVal() { return babMinVal; } /** * Set Level at which you gain a bonus stat * @param aString */ public void setBonusStatLevels(final String aString) { bonusStatLevels.add(aString); } /** * Set Max Level check * @param arg */ public void setChecksMaxLvl(final int arg) { checksMaxLvl = arg; } /** * Get max level check * @return max level check */ public int getChecksMaxLvl() { return checksMaxLvl; } /** * Get the class type by name * @param aClassKey * @return ClassType */ public ClassType getClassTypeByName(final String aClassKey) { for ( ClassType classType : classTypeList ) { if (classType.getName().equalsIgnoreCase(aClassKey)) { return classType; } } return null; } /** * Get the Context Path * @param aTab * @return Context Path */ public String getContextPath(final Tab aTab) { return tInfo.get(aTab).contextPath; } /** * Set the Currency Unit * @param aString */ public void setCurrencyUnit(final String aString) { currencyUnit = aString; } /** * Set the currency Unit abbreviation * @param aString */ public void setCurrencyUnitAbbrev(final String aString) { currencyUnitAbbrev = aString; } /** * Get Damage down map * @return Map of damage downs */ public Map<String, String> getDamageDownMap() { return damageDownMap; } /** * Set DR text * @param aString */ public void setDamageResistanceText(final String aString) { damageResistance = aString; } /** * Weapon size changes damage * @return Map */ public Map<String, String> getDamageUpMap() { return damageUpMap; } /** * Set the default spell book * @param aString */ public void setDefaultSpellBook(final String aString) { defaultSpellBook = aString; } /** * Define the default unit set for a game mode * @param aString **/ public void setDefaultUnitSet(final String aString) { defaultUnitSet = aString; } /** * Used for Output sheets and GUI to order items in a list * @param aString **/ public void setDisplayOrder(final String aString) { try { displayOrder = Integer.parseInt(aString); } catch (NumberFormatException exc) { Logging.errorPrint("Will use default for displayOrder: " + displayOrder, exc); } } /** * This is used to hold the weapon size penalty * @param anOb */ public void setEqSizePenaltyObj(final PObject anOb) { eqSizePenalty = anOb; } /* ************************* * FLP WEAPONSIZEPENALTY3.5 * *************************/ /** * Get the equipment size penalty object * @return PObject representing the equipment size penalty */ public static PObject getEqSizePenaltyObj() { return eqSizePenalty; } /** * Set the levels at which you gain bonus feats * @param aString */ public void setBonusFeatLevels(final String aString) { bonusFeatLevels.add(aString); } /** * @return the folderName */ public String getFolderName() { return folderName; } /** * Set the HP Abbreviation * @param aString */ public void setHPAbbrev(final String aString) { hpAbbrev = aString; } /** * Set the HP Text * @param aString */ public void setHPText(final String aString) { hpName = aString; } /** * Set the Rank Modifier Formula * @param aString */ public void setRankModFormula(final String aString) { rankModFormula = aString; } /** * map of LevelInfo objects. * * @param xpTable the xp table to be used * * @return level info map */ public Map<String, LevelInfo> getLevelInfo(final String xpTable) { return levelInfo.get(xpTable); } /** * Add the level info * @param levInfo */ public void addLevelInfo(final String xpTable, final LevelInfo levInfo) { Map<String, LevelInfo> tableInfo = levelInfo.get(xpTable); if (tableInfo == null) { tableInfo = new HashMap<String, LevelInfo>(); levelInfo.put(xpTable, tableInfo); } tableInfo.put(levInfo.getLevelString(),levInfo); } /** * Set the level up message * @param aString */ public void setLevelUpMessage(final String aString) { levelUpMessage = aString; } /** * Get the level up message * @return the level up message */ public String getLevelUpMessage() { return levelUpMessage; } /** * Get the menu entry * @return menu entry */ public String getMenuEntry() { if (menuEntry == null) { return name; } return menuEntry; } /** * Get the menu tool tip * @return menu tool tip */ public String getMenuToolTip() { if (menuToolTip == null) { return ""; } return menuToolTip; } /** * Set the game mode name * @param aString */ public void setModeName(final String aString) { menuEntry = aString; } /** * Set the game mode tool tip * @param aString */ public void setModeToolTip(final String aString) { menuToolTip = aString; } /** * Get the game mode name * @return game mode name */ public String getName() { return name; } /** * Set the game mode name (aka key). Should not * be used after game mode is loaded. * @param name the name to set */ public void setName(String name) { this.name = name; } /** * Get Plus calculation * @param type * @return plus calculation */ public String getPlusCalculation(final String type) { String aString = null; if (plusCalcs != null) { aString = plusCalcs.get(type); } return aString; } /** * Get a rule given a key * @param aKey * @return RucleCheck */ public RuleCheck getRuleByKey(final String aKey) { return ruleCheckMap.get(aKey); } /** * Return true if a RuleCheck exists for a key * @param aKey * @return true if a RuleCheck exists for a key */ public boolean getRuleCheck(final String aKey) { if (ruleCheckMap.containsKey(aKey)) { final RuleCheck aRule = ruleCheckMap.get(aKey); return aRule.getDefault(); } return false; } /** * Get the RuleCheck List * @return the RuleCheck List */ public List<RuleCheck> getRuleCheckList() { return new ArrayList<RuleCheck>(ruleCheckMap.values()); } /** * Set the Short Range distance * @param aShortRange */ public void setShortRangeDistance(final int aShortRange) { shortRangeDistance = aShortRange; } /** * Get the shortrange distance * @return the shortrange distance */ public int getShortRangeDistance() { return shortRangeDistance; } /** * Set the show class defense parameter * @param argShowDef */ public void setShowClassDefense(final boolean argShowDef) { showClassDefense = argShowDef; } /** * Set the skill multiplier levels * @param pipeList */ public void setSkillMultiplierLevels(final String pipeList) { final StringTokenizer aTok = new StringTokenizer(pipeList, "|", false); skillMultiplierLevels.clear(); while (aTok.hasMoreTokens()) { skillMultiplierLevels.add(aTok.nextToken()); } } /** * Set the base DC for spells * @param arg */ public void setSpellBaseDC(final String arg) { spellBaseDC = arg; } /** * Get the base DC for Spells * @return the base DC for Spells */ public String getSpellBaseDC() { return spellBaseDC; } /** * The formula used to compute spell ranges * @param aString */ public void setSpellRangeFormula(final String aString) { final StringTokenizer aTok = new StringTokenizer(aString, "|", false); if (aTok.countTokens() < 2) { return; } final String aRange = aTok.nextToken().toUpperCase(); final String aFormula = aTok.nextToken(); spellRangeMap.put(aRange, aFormula); } /** * Returns the formula used for calculate the range of a spell * @param aRange * @return spell range formula */ public String getSpellRangeFormula(final String aRange) { String aString = null; if (spellRangeMap != null) { aString = spellRangeMap.get(aRange); } return aString; } /** * Set the context for a tab * @param aTab * @param argTabContext */ public void setTabContext(final Tab aTab, final String argTabContext) { tInfo.get(aTab).contextPath = argTabContext; } /** * Set the name of the tab * @param aTab * @param argTabName */ public void setTabName(final Tab aTab, final String argTabName) { tInfo.get(aTab).tabName = argTabName; } /** * Get the name of the tab * @param aTab * @return tab name */ public String getTabName(final Tab aTab) { String temp = tInfo.get(aTab).tabName; if (temp.startsWith("in_")) { temp = PropertyFactory.getString(temp); } return temp; } /** * Get the singular (e.g. No 's') verson of the tab name * @param aTab * @return the singular (e.g. No 's') verson of the tab name */ public String getSingularTabName(final Tab aTab) { String singularName = getTabName(aTab); if (singularName.endsWith("s")) { singularName = singularName.substring(0, singularName.length() - 1); } return singularName; } /** * Get the tab number * @param tabName * @return tab number */ public static Tab getTab(final String tabName) { for (Tab aTab : Tab.values()) { if (tabName.equalsIgnoreCase(aTab.toString())) { return aTab; } } return Tab.INVALID; } /** * Set the BAB Attack Bonus cycle * @param arg */ public void setBabAttCyc(final int arg) { babAttCyc = arg; } /** * Get the BAB Attack Bonus cycle * @return the BAB Attack Bonus cycle */ public int getBabAttCyc() { return babAttCyc; } /** * Set the maximum BAB attacks allowed * @param arg */ public void setBabMaxAtt(final int arg) { babMaxAtt = arg; } /** * Get the max BAB attacks allowed * @return the max BAB attacks allowed */ public int getBabMaxAtt() { return babMaxAtt; } /** * Set the max BAB level * @param arg */ public void setBabMaxLvl(final int arg) { babMaxLvl = arg; } /** * Get the max BAB level * @return the max BAB level */ public int getBabMaxLvl() { return babMaxLvl; } /** * True if the tab is visible * @param aTab * @return True if the tab is visible */ public boolean getTabShown(final Tab aTab) { return tInfo.get(aTab).visible; } /** * Set the visibility of a tab * @param aTab * @param visible */ public void setTabVisible(final Tab aTab, final boolean visible) { tInfo.get(aTab).visible = visible; } /** * Set a 2nd variable display name * @param aString */ public void setVariableDisplay2Name(final String aString) { displayVariable2Name = aString; } /** * Set a 2nd variable display text * @param aString */ public void setVariableDisplay2Text(final String aString) { displayVariable2Text = aString; } /** * Set a 3rd variable display name * @param aString */ public void setVariableDisplay3Name(final String aString) { displayVariable3Name = aString; } /** * Set a 3rd variable display text * @param aString */ public void setVariableDisplay3Text(final String aString) { displayVariable3Text = aString; } /** * Set a variable display name * @param aString */ public void setVariableDisplayName(final String aString) { displayVariableName = aString; } /** * Set a 2nd variable display text * @param aString */ public void setVariableDisplayText(final String aString) { displayVariableText = aString; } /** * Formula used to compute Wield Category steps * @param aString **/ public void setWCStepsFormula(final String aString) { wcStepsFormula = aString; } /** * Get the formula used to compute Wield Category steps * @return formula used to compute Wield Category steps */ public String getWCStepsFormula() { return wcStepsFormula; } /** * Get the weapon categories * @return the weapon categories */ public String getWeaponCategories() { return weaponCategories; } /** * Get the weapon types * @return the weapon types */ public String getWeaponTypes() { return weaponTypes; } /** * Get the wield category * @param aName * @return wield category */ public WieldCategory getWieldCategory(final String aName) { for ( WieldCategory wCat : wieldCategoryList ) { if (wCat.getName().equals(aName)) { return wCat; } } return null; } /** * Get the weapon reach formula * @return String the weaopn reach formula */ public String getWeaponReachFormula () { return this.weaponReachFormula; } /** * Return true if the AC Type is Valid * @param ACType * @return true if the AC Type is Valid */ public boolean isValidACType(final String ACType) { if (ACTypeAddMap.containsKey(ACType)) { return true; } if (ACTypeRemoveMap.containsKey(ACType)) { return true; } return false; } /** * Add AC Type * @param ACTypeLine */ public void addACType(final String ACTypeLine) { final StringTokenizer aTok = new StringTokenizer(ACTypeLine, "\t"); if (!aTok.hasMoreTokens()) { Logging.errorPrint("Empty tag in miscinfo.ACTYPE"); return; } final String ACType = aTok.nextToken(); while (aTok.hasMoreTokens()) { final String aString = aTok.nextToken(); if (aString.startsWith("ADD:")) { final List<String> aList; if (ACTypeAddMap.containsKey(ACType)) { aList = ACTypeAddMap.get(ACType); } else { aList = new ArrayList<String>(); } aList.add(aString.substring(4)); ACTypeAddMap.put(ACType, aList); } else if (aString.startsWith("REMOVE:")) { final List<String> aList; if (ACTypeRemoveMap.containsKey(ACType)) { aList = ACTypeRemoveMap.get(ACType); } else { aList = new ArrayList<String>(); } aList.add(aString.substring(7)); ACTypeRemoveMap.put(ACType, aList); } else { Logging.errorPrint("Incorrect tag in miscinfo.ACTYPE: " + aString); } } } /** * Add Class Type * @param aString */ public void addClassType(final String aString) { if (".CLEAR".equals(aString)) { classTypeList = null; return; } if (classTypeList == null) { classTypeList = new ArrayList<ClassType>(); } final ClassType aClassType = new ClassType(); final StringTokenizer aTok = new StringTokenizer(aString, "\t"); aClassType.setName(aTok.nextToken()); //Name of the Class Type while (aTok.hasMoreTokens()) { final String bString = aTok.nextToken(); if (bString.startsWith("CRFORMULA:")) { aClassType.setCRFormula(bString.substring(10)); } else if (bString.startsWith("XPPENALTY:")) { aClassType.setXPPenalty(bString.substring(10).equals("YES")); } else if (bString.startsWith("ISMONSTER:")) { aClassType.setMonster(bString.substring(10).equals("YES")); } else { Logging.errorPrint("Incorrect tag in miscinfo.CLASSTYPE: " + bString); } } classTypeList.add(aClassType); } /** * Add a data set to the list of Default Data Sets * @param dataSetKey The key of the data set to add. */ public void addDefaultDataSet(final String dataSetKey) { if (defaultDataSetList == null) { defaultDataSetList = new ArrayList<String>(); } defaultDataSetList.add(dataSetKey); } /** * Empty the list of Default Data Sets. */ public void clearDefaultDataSetList() { defaultDataSetList.clear(); } /** * Add Diety List * @param argDeityLine */ public void addDeityList(final String argDeityLine) { if (".CLEAR".equals(argDeityLine)) { defaultDeityList = null; return; } if (defaultDeityList == null) { defaultDeityList = new ArrayList<String>(); } defaultDeityList.add(argDeityLine); } /** * Add Load String * @param aString */ public void addLoadString(final String aString) { loadStrings.add(aString); } /** * Add Plus calculation * @param aString */ public void addPlusCalculation(final String aString) { final int idx = aString.indexOf('|'); if (idx > 0) { if (plusCalcs == null) { plusCalcs = new HashMap<String, String>(); } plusCalcs.put(aString.substring(0, idx).toUpperCase(), aString.substring(idx + 1)); } } /** * RuleCheck lists. * * @param aRule the rule to check */ public void addRule(final RuleCheck aRule) { ruleCheckMap.put(aRule.getKey(), aRule); } /** * Add a Weapon Category * @param aString */ public void addWeaponCategory(final String aString) { weaponCategories += ('|' + aString); } /** * Add a Weapon Type * @param aString */ public void addWeaponType(final String aString) { weaponTypes += ('|' + aString); } /** * Wield Categories * @param wCat */ public void addWieldCategory(final WieldCategory wCat) { wieldCategoryList.add(wCat); } /** * The "steps" up or down in the Wield Category chain * @param aLine **/ public void addWieldCategorySteps(final String aLine) { wcStepsList.clear(); final StringTokenizer aTok = new StringTokenizer(aLine, "|"); while (aTok.hasMoreTokens()) { final String aName = aTok.nextToken(); wcStepsList.add(aName); } } public int compareTo(final Object obj) { if (obj != null) { final int iOrder = ((GameMode) obj).getDisplayOrder(); if (iOrder < displayOrder) { return 1; } else if (iOrder > displayOrder) { return -1; } // // Order matches, so put in alphabetical order // // should throw a ClassCastException for non-PObjects, // like the Comparable interface calls for return name.compareToIgnoreCase(((GameMode) obj).name); } return 1; } /** * Set the weapobn reach forumla * @param aString the new weapon reach formula */ public void setWeaponReachFormula (String aString) { this.weaponReachFormula = aString; } /** * Return true if RuleCheck exists given a key * @param aKey * @return true if RuleCheck exists given a key */ public boolean hasRuleCheck(final String aKey) { if (ruleCheckMap.containsKey(aKey)) { return true; } return false; } String getACAbbrev() { return acAbbrev; } /** * AC Info * @return AC text */ String getACText() { return acName; } /** * Alignment * @return alignment name */ String getAlignmentText() { return alignmentName; } List<String> getAllowedModes() { if (allowedModes == null) { final List<String> modes = new ArrayList<String>(1); modes.add(name); return modes; } return allowedModes; } String getAltHPAbbrev() { return althpAbbrev; } /** * Wound Points * @return alt hp name */ String getAltHPText() { return althpName; } /** * Levels at which all characters get bonus feats * @return List */ List<String> getBonusFeatLevels() { return bonusFeatLevels; } /** * Levels at which all characters get bonus to stats * @return List */ List<String> getBonusStatLevels() { return bonusStatLevels; } /** * Currency abbreviation * @return currency unit abbreviation */ String getCurrencyDisplay() { return currencyUnitAbbrev; } /** * Get Damage Resistance Text * @return Get Damage Resistance Text */ String getDamageResistanceText() { return damageResistance; } /** * Default spell book name * @return default spell book */ String getDefaultSpellBook() { return defaultSpellBook; } /** * Default unit set * @return default unit set */ String getDefaultUnitSet() { return defaultUnitSet; } List<String> getDeityList() { return defaultDeityList; } /** * Gets the list of default data sets. * * @return the default data set list */ public List<String> getDefaultDataSetList() { return defaultDataSetList; } int getDisplayOrder() { return displayOrder; } /** * HP * @return HP abbreviation */ String getHPAbbrev() { return hpAbbrev; } String getHPText() { return hpName; } List<String> getLoadStrings() { return loadStrings; } /** * Currency unit * @return currency unit */ String getLongCurrencyDisplay() { return currencyUnit; } String getRankModFormula() { return rankModFormula; } boolean getShowClassDefense() { return showClassDefense; } List<String> getSkillMultiplierLevels() { return skillMultiplierLevels; } String getVariableDisplay2Name() { return displayVariable2Name; } String getVariableDisplay2Text() { return displayVariable2Text; } String getVariableDisplay3Name() { return displayVariable3Name; } String getVariableDisplay3Text() { return displayVariable3Text; } String getVariableDisplayName() { return displayVariableName; } /** * Variable Display * @return variable display text */ String getVariableDisplayText() { return displayVariableText; } private static class TabInfo { String tabName = ""; String contextPath = ""; boolean visible = true; } /** * Return an <b>unmodifiable</b> version of the stat list. * @return List */ public List<PCStat> getUnmodifiableStatList() { return Collections.unmodifiableList(statList); } //STATLIST /** * Add to the stat list. * * @param stat the PC stat */ public void addToStatList(final PCStat stat) { statList.add(stat); } /** * Clear out the stat list. */ public void clearStatList() { statList.clear(); } /** * Set the long description of attributes * @param s */ public void setAttribLong(final String[] s) { s_ATTRIBLONG = s; } /** * Set the long description of a particular attribute * @param index * @param s */ public void setAttribLong(final int index, final String s) { s_ATTRIBLONG[index] = s; } /** * Set the short description of attributes * @param s */ public void setAttribShort(final String[] s) { s_ATTRIBSHORT = s; } /** * Set the short description of a particular attribute * @param s * @param index */ public void setAttribShort(final int index, final String s) { s_ATTRIBSHORT[index] = s; } /** * Returns the index of the requested attribute abbreviation, * The attributes used are loaded from a lst file * * @param attributeAbbreviation to find the index of * @return the index of the attribute * returns -1 if the attribute is not matched (or null) */ public int getStatFromAbbrev(final String attributeAbbreviation) { if (s_ATTRIBSHORT != null) { for (int stat = 0; stat < s_ATTRIBSHORT.length; ++stat) { if (attributeAbbreviation.equalsIgnoreCase(s_ATTRIBSHORT[stat])) { return stat; } } } return -1; } //CHECKLIST /** * Add a check to the list of checks. * * @param obj to add to the check list */ public void addToCheckList(final PObject obj) { checkList.add(obj); } /** * Empty the check list. */ public void clearCheckList() { checkList.clear(); } /** * Return the requested object. * @param aName * @return PObject */ public PObject getCheckNamed(final String aName) { final PObject check; final int index = getIndexOfCheck(aName); if (index == -1) { check = null; } else { check = checkList.get(index); } return check; } /** * Get the Index of a Check * @param check * @return index of a check */ public int getIndexOfCheck(final String check) { for (int i = 0; i < checkList.size(); ++i) { if (checkList.get(i).toString().equalsIgnoreCase(check)) { return i; } } return -1; // not found } /** * Return an <b>unmodifiable</b> version of the check list. * @return an <b>unmodifiable</b> version of the check list. */ public List<PObject> getUnmodifiableCheckList() { return Collections.unmodifiableList(checkList); } /** * Returns the check key of the check at the index specified. * * @param anIndex Index of the check in the game mode check list. * * @return A key for the check. */ public String getCheckKey( final int anIndex ) { if (anIndex < 0 || anIndex >= checkList.size()) { return ""; } return checkList.get(anIndex).getKeyName(); } //ALIGNMENTLIST /** * Add to the alignment list. * * @param alignment the alignment */ public void addToAlignmentList(final PCAlignment alignment) { alignmentList.add(alignment); } /** * Clear out the alignment list. */ public void clearAlignmentList() { alignmentList.clear(); } /** * Get the Alignment of the PC given an index * @param index * @return the Alignment of the PC */ public PCAlignment getAlignmentAtIndex(final int index) { final PCAlignment align; if ((index < 0) || (index >= alignmentList.size())) { align = null; } else { align = alignmentList.get(index); } return align; } /** * Returns an array of alignment names. * @param useLongForm True if the long names should be returned. * @return alignment list Strings */ public String[] getAlignmentListStrings(final boolean useLongForm) { final String[] al = new String[alignmentList.size()]; int x = 0; for ( PCAlignment alignment : alignmentList ) { if (useLongForm) { al[x++] = alignment.getDisplayName(); } else { al[x++] = alignment.getKeyName(); } } return al; } /** * Return the index of the alignment name (handles both short and long names.) * @param anAlignmentName * @return index */ public int getIndexOfAlignment(final String anAlignmentName) { for (int i = 0; i < alignmentList.size(); ++i) { final PCAlignment alignment = alignmentList.get(i); // if long name or short name of alignment matches, return index if (alignment.getDisplayName().equalsIgnoreCase(anAlignmentName) || alignment.getKeyName().equalsIgnoreCase(anAlignmentName)) { return i; } } return -1; // not found } /** * Returns a <tt>PCAlignment</tt> object for the alignment key or name * passed in. * * @param aKey A short alignment (LG) or long alignment (Lawful Good) * * @return A <tt>PCAlignment</tt> object or null if no match is found. */ public PCAlignment getAlignment( final String aKey ) { for ( final PCAlignment align : alignmentList ) { // if long name or short name of alignment matches, return index if (align.getDisplayName().equalsIgnoreCase(aKey) || align.getKeyName().equalsIgnoreCase(aKey)) { return align; } } return null; } /** * Return the long version of the alignment name found at the index. (E.g. Lawful Good) * @param index * @return String */ public String getLongAlignmentAtIndex(final int index) { final String alName; final PCAlignment al = getAlignmentAtIndex(index); if (al == null) { alName = ""; } else { alName = al.getDisplayName(); } return alName; } /** * Return the short version of the alignment name found at the index. (E.g. LG) * @param index * @return String */ public String getShortAlignmentAtIndex(final int index) { final PCAlignment al = getAlignmentAtIndex(index); if (al == null) { return ""; } return al.getKeyName(); } /** * Return an <b>unmodifiable</b> version of the alignmentlist. * @return an <b>unmodifiable</b> version of the alignmentlist. */ public List<PCAlignment> getUnmodifiableAlignmentList() { return Collections.unmodifiableList(alignmentList); } /** * Set the range increment penalty for ranged weapons. * * @param value * For penalties set this to be a negative number, for bonuses to * long range set this to be a positive number, for no range * penalty set this to be 0 */ public void setRangePenalty(int value) { rangePenalty = value; } /** * Get the range penalty * @return range penalty */ public int getRangePenalty() { return rangePenalty; } /** * Set the cost for class skills * @param value */ public void setSkillCost_Class(int value) { skillCosts_Class = value; } /** * Set the cost for cross class skills * @param value */ public void setSkillCost_CrossClass(int value) { skillCost_CrossClass = value; } /** * Set the cost for exclusive skills * @param value */ public void setSkillCost_Exclusive(int value) { skillCost_Exclusive = value; } /** * Get the cost for class skills * @return cost for class skills */ public int getSkillCost_Class() { return skillCosts_Class; } /** * Get the cost for cross class skills * @return cost for cross class skills */ public int getSkillCost_CrossClass() { return skillCost_CrossClass; } /** * Get the cost for exclusive skills * @return cost for exclusive skills */ public int getSkillCost_Exclusive() { return skillCost_Exclusive; } /** * Set the point pool name * @param argPoolName */ public void setPointPoolName(final String argPoolName) { pointPoolName = argPoolName; } /** * Get the point pool name * @return point pool name */ public String getPointPoolName() { return pointPoolName; } /** * Set the penalty for non proficiency * @param argPenalty */ public void setNonProfPenalty(final int argPenalty) { nonProfPenalty = argPenalty; } /** * Get the penalty for non proficiency * @return the penalty for non proficiency */ public int getNonProfPenalty() { return nonProfPenalty; } /** * Set the HP Formula * @param argFormula */ public void setHPFormula(final String argFormula) { hpFormula = argFormula; } /** * Get the HP Formula * @return HP Formula */ public String getHPFormula() { return hpFormula; } /** * Set Add with meta magic message * @param argMsg */ public void setAddWithMetamagicMessage(final String argMsg) { addWithMetamagic = argMsg; } /** * Get add with meta magic message * @return add with meta magic message */ public String getAddWithMetamagicMessage() { return addWithMetamagic; } /** * Add to the bonus spell map * @param level * @param baseStatScore * @param statRange */ public void addToBonusSpellMap(final String level, final String baseStatScore, final String statRange) { bonusSpellMap.put(level, baseStatScore + '|' + statRange); } /** * Get the bonus spell map * @return the bonus spell map */ public Map<String, String> getBonusSpellMap() { return bonusSpellMap; } /** * Set square size * @param argSize */ public void setSquareSize(final double argSize) { squareSize = argSize; } /** * Get square size * @return square size */ public double getSquareSize() { return squareSize; } /** * Get the set unit * @return the unti that is set */ public UnitSet getUnitSet() { return selectedUnitSet; } /** * Return true if the unit has been set * @param unitSetName * @return true if the unit has been set */ public boolean selectUnitSet(final String unitSetName) { final UnitSet ui = SystemCollections.getUnitSet(unitSetName, name); if (ui == null) { return false; } selectedUnitSet = ui; return true; } /** * Return true if the default unit has been set * @return true if the unit has been set */ public boolean selectDefaultUnitSet() { final UnitSet ui = SystemCollections.getUnitSetNamed(defaultUnitSet, name); if (ui == null) { return false; } selectedUnitSet = ui; return true; } /** * Add a stat/cost pair to purchase mode stat costs. * @param statValue * @param cost */ public void addPointBuyStatCost(final int statValue, final int cost) { PointBuyCost pbc = new PointBuyCost(statValue); pbc.setStatCost(cost); addPointBuyStatCost(pbc); } /** * Add a PointBuyCost object to purchase mode stat costs. * @param pbc */ public void addPointBuyStatCost(final PointBuyCost pbc) { if (pointBuyStatCosts == null) { // Sort NUMERICALLY, not alphabetically! // CONSIDER Huh? The natural order of Integer IS numerically... - thpr 10/20/06 pointBuyStatCosts = new TreeMap<Integer, PointBuyCost>(new ComparableComparator<Integer>()); } abilityScoreCost = null; pointBuyStatCosts.put(Integer.valueOf(pbc.getStatValue()), pbc); } /** * Add a purchase mode method. * @param methodName * @param points */ public void addPurchaseModeMethod(final String methodName, final String points) { addPurchaseModeMethod(new PointBuyMethod(methodName, points)); } /** * Add a purchase mode method. * @param pbm */ public void addPurchaseModeMethod(final PointBuyMethod pbm) { if (getPurchaseMethodByName(pbm.getMethodName()) == null) { if (pointBuyMethods == null) { pointBuyMethods = new ArrayList<PointBuyMethod>(); } pointBuyMethods.add(pbm); } } /** * Clear purchase mode stat costs. */ public void clearPointBuyStatCosts() { pointBuyStatCosts = null; abilityScoreCost = null; } /** * Get the point buy by stat mapping * @return the point buy by stat mapping */ public SortedMap<Integer, PointBuyCost> getPointBuyStatCostMap() { return pointBuyStatCosts; } /** * Clear the purchase mode methods */ public void clearPurchaseModeMethods() { pointBuyMethods = null; } /** * Find a user-defined purchase method by name. * @param methodName * @return the purchase method or null */ public PointBuyMethod getPurchaseMethodByName(final String methodName) { if (pointBuyMethods != null) { for ( PointBuyMethod pbm : pointBuyMethods ) { if (pbm.getMethodName().equalsIgnoreCase(methodName)) { return pbm; } } } return null; } /** * Get the number of user-defined purchase methods. * @return purchase method count */ public int getPurchaseMethodCount() { if (pointBuyMethods != null) { return pointBuyMethods.size(); } return 0; } /** * Set the purchase mode method name * @param argMethodName */ public void setPurchaseMethodName(final String argMethodName) { if (argMethodName.length() != 0) { setRollMethod(Constants.CHARACTERSTATMETHOD_PURCHASE); } purchaseMethodName = argMethodName; } /** * Get the highest stat score that can be purchased free. * @param aPC * @return purchase mode base score */ public int getPurchaseModeBaseStatScore(final PlayerCharacter aPC) { int minVal = getPurchaseScoreMin(aPC); for (int i = 0, x = getPurchaseScoreMax() - getPurchaseScoreMin() + 1; i < x; ++i) { if (getAbilityScoreCost(i) == 0) { if ((getPurchaseScoreMin() + i) >= minVal) { return getPurchaseScoreMin() + i; } } } // // Make sure that the minimum stat value is legal. This could happen if there are no // stat values that are considered to be free. // if (getPurchaseScoreMin() == minVal) { minVal -= 1; if (minVal < statMin) { minVal = statMin; } } return minVal; } /** * Get the purchase mode method name * @return the purchase mode method name */ public String getPurchaseModeMethodName() { if (!isPurchaseStatMode()) { return null; } return purchaseMethodName; } /** * Get the purchase mode method pool formula * @return the purchase mode method pool formula */ public String getPurchaseModeMethodPoolFormula() { if (!isPurchaseStatMode()) { return "-1"; } return getPurchaseMethodByName(purchaseMethodName).getPointFormula(); } /** * Get the highest stat value in the purchase mode stat table. * @return purchase mode maximum */ public int getPurchaseScoreMax() { if (pointBuyStatCosts == null) { return -1; } return pointBuyStatCosts.lastKey(); } /** * Get the maximum score you can purchase * @param pc * @return the maximum score you can purchase */ public int getPurchaseScoreMax(final PlayerCharacter pc) { if (pc == null) { return getPurchaseScoreMax(); } int lastStat = -1; if (pointBuyStatCosts != null) { boolean bPassed = false; for ( Integer statValue : pointBuyStatCosts.keySet() ) { final PointBuyCost pbc = pointBuyStatCosts.get(statValue); if (!PrereqHandler.passesAll(pbc.getPreReqList(), pc, null)) { // // If have passed any prereqs already, then stop looking and use the highest passing stat // if (bPassed) { break; } } else { lastStat = statValue.intValue(); } } } return lastStat; } /** * Get the lowest stat value in the purchase mode stat table. * @return purchase score minimum */ public int getPurchaseScoreMin() { if (pointBuyStatCosts == null) { return -1; } return pointBuyStatCosts.firstKey(); } /** * Get the minimum score you can purchase * @param pc * @return the minimum score you can purchase */ public int getPurchaseScoreMin(final PlayerCharacter pc) { if (pc == null) { return getPurchaseScoreMin(); } int lastStat = -1; if (pointBuyStatCosts != null) { for ( int statValue : pointBuyStatCosts.keySet() ) { final PointBuyCost pbc = pointBuyStatCosts.get(statValue); if (PrereqHandler.passesAll(pbc.getPreReqList(), pc, null)) { lastStat = statValue; break; } } } return lastStat; } /** * Returns true if we are in a stat purchase mode * @return true if we are in a stat purchase mode */ public boolean isPurchaseStatMode() { // Can't have purchase mode if no costs specified if ((pointBuyStatCosts == null) || (pointBuyStatCosts.size() == 0) || (getRollMethod() != Constants.CHARACTERSTATMETHOD_PURCHASE) || (purchaseMethodName.length() == 0)) { return false; } return getPurchaseMethodByName(purchaseMethodName) != null; } /** * Get the purchase method * @param idx * @return the purchase method */ public PointBuyMethod getPurchaseMethod(final int idx) { if ((pointBuyMethods == null) || (idx > pointBuyMethods.size())) { return null; } return pointBuyMethods.get(idx); } /** * @param argRollMethod */ public void setRollMethod(final int argRollMethod) { rollMethod = argRollMethod; if (argRollMethod != Constants.CHARACTERSTATMETHOD_PURCHASE) { setPurchaseMethodName(""); //$NON-NLS-1$ } } /** * @return roll method */ public int getRollMethod() { return rollMethod; } /** * Get the cost for an ability score * @return the cost for an ability score */ public int[] getAbilityScoreCost() { if (!isPurchaseStatModeAllowed()) { //better to return a Zero length array than null. return null; } // Only build this list once if (abilityScoreCost != null) { return abilityScoreCost; } abilityScoreCost = new int[getPurchaseScoreMax() - getPurchaseScoreMin() + 1]; // Should be 1 value for each stat in range int i = 0; int lastStat = Integer.MIN_VALUE; int lastCost = 0; for ( int statValue : pointBuyStatCosts.keySet() ) { // Fill in any holes in the stat list by using the previous stat cost if ((lastStat != Integer.MIN_VALUE) && (lastStat + 1 != statValue)) { for (int x = lastStat + 1; x < statValue; ++x) { abilityScoreCost[i++] = lastCost; } } final int statCost = pointBuyStatCosts.get(statValue).getStatCost(); lastStat = statValue; lastCost = statCost; abilityScoreCost[i++] = lastCost; } return abilityScoreCost; } /** * Get the cost for an ability score * @param abilityScoreIndex * @return the cost for an ability score */ public int getAbilityScoreCost(final int abilityScoreIndex) { final int[] asc = getAbilityScoreCost(); if (asc == null) { return 0; } return asc[abilityScoreIndex]; } /** * Set the roll method expression by name * @param aString */ public void setRollMethodExpressionByName(final String aString) { if (aString.length() != 0) { rollingMethodIndex = findRollingMethodByName(aString); if (rollingMethodIndex >= 0) { setRollMethod(Constants.CHARACTERSTATMETHOD_ROLLED); } else { setRollMethod(Constants.CHARACTERSTATMETHOD_USER); } } } /** * Get the cost for an ability score * @return the cost for an ability score */ public String getRollMethodExpression() { final GameModeRollMethod rm = getRollingMethod(rollingMethodIndex); if (rm != null) { return rm.getMethodRoll(); } return ""; } /** * Get roll method expression name * @return roll method expression name */ public String getRollMethodExpressionName() { final GameModeRollMethod rm = getRollingMethod(rollingMethodIndex); if (rm != null) { return rm.getMethodName(); } return ""; } /** * Return true if the purchasing of stats mode is allowed * @return true if the purchasing of stats mode is allowed */ public boolean isPurchaseStatModeAllowed() { if ((pointBuyStatCosts == null) || (pointBuyStatCosts.size() == 0)) { return false; } return true; } /** * Adds the item to the sizeAdjustmentList. * @param item */ public void addToSizeAdjustmentList(final SizeAdjustment item) { if (!sizeAdjustmentList.contains(item)) { sizeAdjustmentList.add(item); } } /** * Clears the sizeAdjustmentList. */ public void clearSizeAdjustmentList() { sizeAdjustmentList.clear(); } /** * Get the default size adjustment * @return the default size adjustment */ public SizeAdjustment getDefaultSizeAdjustment() { for ( SizeAdjustment s : sizeAdjustmentList ) { if (s.isDefaultSize()) { return s; } } return null; } /** * Returns the requested SizeAdjustment item, or null if the index is inappropriate. * @param index * @return the requested SizeAdjustment item, or null if the index is inappropriate. */ public SizeAdjustment getSizeAdjustmentAtIndex(final int index) { SizeAdjustment sa = null; if ((index >= 0) && (index < sizeAdjustmentList.size())) { sa = sizeAdjustmentList.get(index); } return sa; } /** * Returns the size of the sizeAdjustmentList. * @return the size of the sizeAdjustmentList. */ public int getSizeAdjustmentListSize() { return sizeAdjustmentList.size(); } public List<SizeAdjustment> getUnmodifiableSizeAdjustmentList() { return Collections.unmodifiableList(sizeAdjustmentList); } /** * Returns the requested size adjustment. * @param aName * @return the requested size adjustment. */ public SizeAdjustment getSizeAdjustmentNamed(final String aName) { if (aName.trim().length() == 0) { return spareSize; } for ( SizeAdjustment s : sizeAdjustmentList ) { if (s.getDisplayName().equalsIgnoreCase(aName) || s.getAbbreviation().equalsIgnoreCase(aName)) { return s; } } return null; } /** * Set the value for all stats * @param argAllStatsValue */ public void setAllStatsValue(final int argAllStatsValue) { allStatsValue = argAllStatsValue; } /** * Get the value of all stats * @return the value of all stats */ public int getAllStatsValue() { return allStatsValue; } /** * Character generation random rolling techniques * @param methodName The name of the method that will be visible to the user * @param methodRoll A RollingMethods dice expression * @return true if OK */ public boolean addRollingMethod(final String methodName, final String methodRoll) { boolean retStatus = false; // // Remove all roll methods? // if (".CLEAR".equals(methodName)) { rollingMethods = null; retStatus = true; } // // Remove a specific roll method? // else if (methodName.endsWith(".CLEAR")) { /** @todo don't we need to chop off the .CLEAR portion? */ final int idx = findRollingMethodByName(methodName); if (idx >= 0) { rollingMethods.remove(idx); retStatus = true; } } else { if (rollingMethods == null) { rollingMethods = new ArrayList<GameModeRollMethod>(); } final int idx = findRollingMethodByName(methodName); if (idx < 0) { GameModeRollMethod rm = new GameModeRollMethod(methodName, methodRoll); rollingMethods.add(rm); retStatus = true; } } return retStatus; } private int findRollingMethodByName(final String methodName) { for(int i = 0;; ++i) { final GameModeRollMethod rm = getRollingMethod(i); if (rm == null) { return -1; } else if (methodName.equals(rm.getMethodName())) { return i; } } } /** * Get the rolling method * @param idx * @return the rolling method */ public GameModeRollMethod getRollingMethod(final int idx) { if ((rollingMethods != null) && (idx >= 0) && (idx < rollingMethods.size())) { return rollingMethods.get(idx); } return null; } /** * Returns the currently set rolling method for character stats. * * @return GameModeRollMethod the current rolling method */ public GameModeRollMethod getCurrentRollingMethod() { return getRollingMethod(rollingMethodIndex); } /** * Set the minimum stat * @param argMin */ public void setStatMin(final int argMin) { statMin = argMin; } /** * Get the minimum stat * @return minimum stat */ public int getStatMin() { return statMin; } /** * Set the maximum stat * @param argMax */ public void setStatMax(final int argMax) { statMax = argMax; } /** * Get the maximum stat * @return maximum stat */ public int getStatMax() { return statMax; } /** * Return an <b>unmodifiable</b> version of the schools list. * @return an <b>unmodifiable</b> version of the schools list. */ public List<String> getUnmodifiableSchoolsList() { return Collections.unmodifiableList(schoolsList); } /** * Add the school to the list. * @param school */ public void addToSchoolList(final String school) { if (!schoolsList.contains(school)) { schoolsList.add(school); } } /** * Add the dispaly text for a stat * @param statValue * @param statText */ public void addStatDisplayText(final int statValue, final String statText) { if (statDisplayText == null) { // Sort NUMERICALLY, not alphabetically! // CONSIDER Huh? The natural order of Integer IS numerically... - thpr 10/20/06 statDisplayText = new TreeMap<Integer, String>(new ComparableComparator<Integer>()); } statDisplayText.put(statValue, statText); } /** * Get the display text of a stat * @param statValue * @return the display text of a stat */ public String getStatDisplayText(final int statValue) { String statText; // // If no alternate text available, then display the number only // if (statDisplayText == null) { statText = Integer.toString(statValue); } else { statText = statDisplayText.get(statValue); if (statText == null) { final int firstKey = statDisplayText.firstKey(); if (statValue < firstKey) { statText = "???" + Integer.toString(statValue) + "???"; } else { final int lastKey = statDisplayText.lastKey(); statText = getStatDisplayText(lastKey) + statDisplayTextAppend + getStatDisplayText(statValue - lastKey); } } } return statText; } /** * Set the summary tab's stat column to (in)visible * @param columnIndex * @param bVisible */ public void setSummaryTabStatColumnVisible(final int columnIndex, final boolean bVisible) { if ((columnIndex >= 0) && (columnIndex <= 7)) { summaryTabStatColumnVisible[columnIndex] = bVisible; } } /** * True if the summary tab's stat column is visible * @param columnIndex * @return True if the summary tab's stat column is visible */ public boolean getSummaryTabStatColumnVisible(final int columnIndex) { if ((columnIndex >= 0) && (columnIndex <= 7)) { return summaryTabStatColumnVisible[columnIndex]; } return true; } /** */ public void setSkillTabColumnVisible(final int columnIndex, final boolean bVisible) { if ((columnIndex >= 0) && (columnIndex < skillTabColumnVisible.length)) { skillTabColumnVisible[columnIndex] = bVisible; } } /** */ public boolean getSkillTabColumnVisible(final int columnIndex) { if ((columnIndex >= 0) && (columnIndex < skillTabColumnVisible.length)) { return skillTabColumnVisible[columnIndex]; } return true; } /** * Return true if the skill rank display text is there * @return true if the skill rank display text is there */ public boolean hasSkillRankDisplayText() { return (skillRankDisplayText == null) ? false : true; } /** * Add display text for a skill rank * @param rankValue * @param rankText */ public void addSkillRankDisplayText(final int rankValue, final String rankText) { if (skillRankDisplayText == null) { // Sort NUMERICALLY, not alphabetically! // CONSIDER Huh? The natural order of Integer IS numerically... - thpr 10/20/06 skillRankDisplayText = new TreeMap<Integer, String>(new ComparableComparator<Integer>()); } skillRankDisplayText.put(rankValue, rankText); } /** * Get display text for a skill rank * @param rankValue * @return display text for a skill rank */ public String getSkillRankDisplayText(final int rankValue) { String rankText; // // If no alternate text available, then display the number only // if (skillRankDisplayText == null) { rankText = Integer.toString(rankValue); } else { rankText = skillRankDisplayText.get(rankValue); if (rankText == null) { final int firstKey = skillRankDisplayText.firstKey(); if (rankValue < firstKey) { rankText = "???" + Integer.toString(rankValue) + "???"; } else { final int lastKey = skillRankDisplayText.lastKey(); rankText = getSkillRankDisplayText(lastKey) + statDisplayTextAppend + getSkillRankDisplayText(rankValue - lastKey); } } } return rankText; } //BONUSSTACKLIST /** * Add an item to the bonus stacking list. * @param item */ public void addToBonusStackList(final String item) { if(!bonusStackList.contains(item)) { bonusStackList.add(item); } } /** * Clears the bonus stacking list.. */ public void clearBonusStacksList() { bonusStackList.clear(); } /** * Return an <b>unmodifiable</b> version of the bonus stacking list. * @return an <b>unmodifiable</b> version of the bonus stacking list. */ public List<String> getUnmodifiableBonusStackList() { return Collections.unmodifiableList(bonusStackList); } /** * Checks if a bonus type should stack for this game mode. * * @param aBonusType The bonus type * * @return <tt>true</tt> if bonuses of this type stack. */ public boolean bonusStacks( final String aBonusType ) { return bonusStackList.indexOf(aBonusType) != -1; // e.g. Dodge } /** * Adds an <tt>AbilityCategory</tt> definition to the game mode. * * @param aCategory The <tt>AbilityCategory</tt> to add. */ public void addAbilityCategory(final AbilityCategory aCategory) { theAbilityCategories.add(aCategory); } /** * Adds an <tt>AbilityCategory</tt> definition to the game mode. * * @param aCategory The <tt>AbilityCategory</tt> to add. */ public void addLstAbilityCategory(final AbilityCategory aCategory) { theLstAbilityCategories.add(aCategory); } /** * Clears all LST sourced <tt>AbilityCategory</tt> definitions from the * game mode. Used when unloading the data. * * @param aCategory The <tt>AbilityCategory</tt> to add. */ public void clearLstAbilityCategories() { theLstAbilityCategories.clear(); } /** * Gets the <tt>AbilityCategory</tt> for the given key. * * @param aKey The key of the <tt>AbilityCategory</tt> to retreive. * * @return The requested <tt>AbilityCategory</tt> or <tt>null</tt> if the * category is not found in this game mode. */ public AbilityCategory getAbilityCategory(final String aKey) { AbilityCategory ac = silentlyGetAbilityCategory(aKey); // Empty aKey indicates return null because // PreAbilityTester.buildAbilityList uses that as a global // (all Category) getch if (aKey == null || (ac == null && aKey.length() > 0)) { Thread.dumpStack(); Logging.errorPrint("Attempt to fetch AbilityCategory: " + aKey + "... but it does not exist"); } return ac; } public AbilityCategory silentlyGetAbilityCategory(final String aKey) { for ( final AbilityCategory cat : getAllAbilityCategories() ) { if ( cat.getKeyName().equalsIgnoreCase(aKey) ) { return cat; } } return null; } /** * Returns a <tt>Collection</tt> of <tt>AbilityCategory</tt> objects defined * by this game mode. * * @return A <tt>Collection</tt> of <tt>AbilityCategory</tt> objects. */ public Collection<AbilityCategory> getAllAbilityCategories() { if ( !theAbilityCategories.contains(AbilityCategory.FEAT) ) { theAbilityCategories.add(0, AbilityCategory.FEAT); } List<AbilityCategory> allCats = new ArrayList<AbilityCategory>(); allCats.addAll(theAbilityCategories); allCats.addAll(theLstAbilityCategories); return Collections.unmodifiableCollection(allCats); } /** * Returns a <tt>Collection</tt> of <tt>AbilityCategory</tt> objects * defined by this game mode that match the display location. * * @param displayLoc The display location to filter for. * @return A <tt>Collection</tt> of <tt>AbilityCategory</tt> objects. */ public Collection<AbilityCategory> getAllAbilityCatsForDisplayLoc(String displayLoc) { if (displayLoc == null) { return Collections.emptyList(); } List<AbilityCategory> catList = new ArrayList<AbilityCategory>(); for (AbilityCategory cat : getAllAbilityCategories()) { if (displayLoc.equals(cat.getDisplayLocation())) { catList.add(cat); } } return Collections.unmodifiableCollection(catList); } /** * Returns a <tt>Collection</tt> of <tt>AbilityCategory</tt> objects * defined by this game mode that match the category key. * * @param key The category key to filter for. * @return A <tt>Collection</tt> of <tt>AbilityCategory</tt> objects. */ public Collection<AbilityCategory> getAllAbilityCatsForKey(String key) { if (key == null) { return Collections.emptyList(); } List<AbilityCategory> catList = new ArrayList<AbilityCategory>(); for (AbilityCategory cat : getAllAbilityCategories()) { if (key.equals(cat.getKeyName()) || key.equals(cat.getAbilityCategory())) { catList.add(cat); } } return Collections.unmodifiableCollection(catList); } /** * Adds the time unit to the game mode's list. * * @param timeUnit the time unit */ public void addTimeUnit(final TimeUnit timeUnit) { theTimeUnits.add(timeUnit); } /** * Gets the time unit based on its key. * * @param aKey the key * * @return the time unit */ public TimeUnit getTimeUnit(final String aKey) { for (final TimeUnit unit : theTimeUnits) { if (unit.getKeyName().equalsIgnoreCase(aKey)) { return unit; } } return null; } /** * @return the defaultTimeUnit */ public TimeUnit getDefaultTimeUnit() { return defaultTimeUnit; } /** * @param defaultTimeUnit the defaultTimeUnit to set */ public void setDefaultTimeUnit(TimeUnit defaultTimeUnit) { this.defaultTimeUnit = defaultTimeUnit; } public void setPreviewDir(final String aDir) { thePreviewDir = aDir; } public String getPreviewDir() { return thePreviewDir; } public void setDefaultPreviewSheet(final String aSheet) { theDefaultPreviewSheet = aSheet; } public String getDefaultPreviewSheet() { return theDefaultPreviewSheet; } /** * Parses the DIESIZE tag's values to create * the dieSizes array * * @param value */ public void setDieSizes(final String value) { final StringTokenizer aTok = new StringTokenizer(value, ",", false); List<Integer> list = new ArrayList<Integer>(); while (aTok.hasMoreTokens()) { String aString = aTok.nextToken(); // in case there is training\leading whitespace after the comma split aString = aString.trim(); String minValue; String maxValue; try { if (aString.contains("MIN=")) { String[] t = aString.split("MIN="); minValue = t[1]; int die = Integer.parseInt(minValue); setMinDieSize(die); list.add(die); } else if (aString.contains("MAX=")) { String[] t = aString.split("MAX="); maxValue = t[1]; int die = Integer.parseInt(maxValue); setMaxDieSize(die); list.add(die); } else { int die = Integer.parseInt(aString); list.add(die); } } catch (NumberFormatException e) { Logging.errorPrint("Invalid integer value for DIESIZES: " + aString + ". Original value: DIESIZES:"+ value); } } if (list.size() == 0) { return; } int[] dieSizes = new int[list.size()]; for (int i = 0; i < list.size(); i++) { dieSizes[i] = list.get(i); } list = null; this.setDieSizes(dieSizes); } /** * Get's current gamemodes MaxDieSize * @return maxDieSize */ public int getMaxDieSize() { return maxDieSize; } /** * Sets's current gamemodes MaxDieSize * @param dice */ public void setMaxDieSize(final int dice) { maxDieSize = dice; } /** * Get's current gamemodes MinDieSize * @return minDieSize */ public int getMinDieSize() { return minDieSize; } /** * Sets's current gamemodes MinDieSize * @param dice */ public void setMinDieSize(final int dice) { minDieSize = dice; } /** * Get's current gamemodes DieSizes * @return dieSizes array */ public int[] getDieSizes() { return dieSizes; } /** * Set's DieSizes available for the gamemode * @param die The parsed integer diesizes */ public void setDieSizes(int[] die) { this.dieSizes = die; } /** * Retrieve the list of equipment types which flag it as able to * be resized by the automatic resize feature. * @return the resizableTypeList */ public List<String> getResizableTypeList() { return Collections.unmodifiableList(resizableTypeList); } /** * Set the list of equipment types which flag it as able to * be resized by the automatic resize feature. * * @param resizableTypeList the resizableTypeList to set */ public void setResizableTypeList(List<String> resizableTypeList) { this.resizableTypeList = resizableTypeList; } private ConsolidatedListCommitStrategy masterLCS = new ConsolidatedListCommitStrategy(); private LoadContext context = new RuntimeLoadContext(new ReferenceContext(), masterLCS); private GameReferenceContext gameRefContext = new GameReferenceContext(); private LoadContext modeContext = new RuntimeLoadContext(gameRefContext, masterLCS); public void clearLoadContext() { masterLCS = new ConsolidatedListCommitStrategy(); ReferenceContext referenceContext = new ReferenceContext(); for (TransparentReferenceManufacturer<? extends CDOMObject> rm : gameRefContext .getAllManufacturers()) { resolveReferenceManufacturer(referenceContext, rm); } context = new RuntimeLoadContext(referenceContext, masterLCS); } private <T extends CDOMObject> void resolveReferenceManufacturer( ReferenceContext rc, TransparentReferenceManufacturer<T> rm) { rm.resolveUsing(rc.getManufacturer(rm.getReferenceClass())); } public LoadContext getContext() { return context; } public LoadContext getModeContext() { return modeContext; } public MasterListInterface getMasterLists() { return masterLCS; } public void addHiddenType(Class<?> cl, String s) { Set<String> set = hiddenTypes.get(cl); if (set == null) { set = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); hiddenTypes.put(cl, set); } set.add(s); } public boolean isTypeHidden(Class<?> cl, String type) { Set<String> set = hiddenTypes.get(cl); return set != null && set.contains(type); } public int sizeIndex(SizeAdjustment sz) { return sizeAdjustmentList.indexOf(sz); } /** * Gets the name of the currently selected experience table * * @return the XP table name */ public String getXpTableName() { if (currXpTableName == null || currXpTableName.equals("")) { if (xpTableNames.isEmpty()) { xpTableNames.add("Default"); } currXpTableName = xpTableNames.get(0); } return currXpTableName; } /** * Sets the name of the currently selected experience table * * @param tableName the new XP table name */ public void setXpTableName(String tableName) { currXpTableName = tableName; } /** * Gets the array of names of defined experience tables. * * @return the xp table names */ public List<String> getAvailXpTableNames() { return xpTableNames; } /** * Sets the array of names of defined experience tables. * * @param names the new avail XP table names */ public void setAvailXpTableNames(List<String> names) { xpTableNames = names; } public void addXpTable(String name) { xpTableNames.add(name); } /** * Checks if bonus stat stacking is allowed * * @return true, if is bonus stat stacking allowed */ public boolean isBonusStatAllowsStack() { return bonusStatAllowsStack; } /** * Sets the bonus stat stacking allowed value. * * @param bonusStatAllowsStack the new bonus stat allows stack */ public void setBonusStatAllowsStack(boolean bonusStatAllowsStack) { this.bonusStatAllowsStack = bonusStatAllowsStack; } }

The table below shows all metrics for GameMode.java.

MetricValueDescription
BLOCKS446.00Number of blocks
BLOCK_COMMENT28.00Number of block comment lines
COMMENTS1133.00Comment lines
COMMENT_DENSITY 1.01Comment density
COMPARISONS175.00Number of comparison operators
CYCLOMATIC432.00Cyclomatic complexity
DECL_COMMENTS250.00Comments in declarations
DOC_COMMENT1058.00Number of javadoc comment lines
ELOC1118.00Effective lines of code
EXEC_COMMENTS19.00Comments in executable code
EXITS163.00Procedure exits
FUNCTIONS271.00Number of function declarations
HALSTEAD_DIFFICULTY78.96Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY505.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 0.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 2.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 0.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 1.00JAVA0075 Method parameter hides field
JAVA0076 7.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 0.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 0.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 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 1.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 4.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 1.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 0.00JAVA0116 Missing javadoc: field 'field'
JAVA011714.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 1.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 0.00JAVA0128 Public constructor in non-public class
JAVA0130 1.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 0.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 3.00JAVA0144 Line exceeds maximum M characters
JAVA01454807.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 0.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 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 1.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 9.00JAVA0177 Variable declaration missing initializer
JAVA0179 1.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 0.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 5.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
JAVA025911.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 1.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 0.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 0.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
LINES3547.00Number of lines in the source file
LINE_COMMENT47.00Number of line comments
LOC2011.00Lines of code
LOGICAL_LINES675.00Number of statements
LOOPS13.00Number of loops
NEST_DEPTH 5.00Maximum nesting depth
OPERANDS2911.00Number of operands
OPERATORS6218.00Number of operators
PARAMS178.00Number of formal parameter declarations
PROGRAM_LENGTH9129.00Halstead program length
PROGRAM_VOCAB1030.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS327.00Number of return points from functions
SIZE72043.00Size of the file in bytes
UNIQUE_OPERANDS977.00Number of unique operands
UNIQUE_OPERATORS53.00Number of unique operators
WHITESPACE403.00Number of whitespace lines