From: <th...@us...> - 2012-02-24 03:16:01
|
Revision: 16279 http://pcgen.svn.sourceforge.net/pcgen/?rev=16279&view=rev Author: thpr Date: 2012-02-24 03:15:54 +0000 (Fri, 24 Feb 2012) Log Message: ----------- Docs Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/cdom/facet/SpellSupportFacet.java Trunk/pcgen/code/src/java/pcgen/cdom/facet/StartingLanguageFacet.java Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatFacet.java Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatLockFacet.java Trunk/pcgen/code/src/java/pcgen/cdom/facet/SubClassFacet.java Trunk/pcgen/code/src/java/pcgen/cdom/facet/SuppressBioFieldFacet.java Trunk/pcgen/code/src/java/pcgen/cdom/facet/TotalWeightFacet.java Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/SpellSupportFacet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/cdom/facet/SpellSupportFacet.java 2012-02-24 03:15:09 UTC (rev 16278) +++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/SpellSupportFacet.java 2012-02-24 03:15:54 UTC (rev 16279) @@ -1,3 +1,20 @@ +/* + * Copyright (c) Thomas Parker, 2010. + * + * This program 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 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 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package pcgen.cdom.facet; import pcgen.core.PCClass; @@ -3,4 +20,10 @@ import pcgen.core.SpellSupportForPCClass; +/** + * SpellSupportFacet stores the SpellSupportForPCClass objects that are + * associated to the PCClass objects that are part of a Player Character. + * + * @author Thomas Parker (thpr [at] yahoo.com) + */ public class SpellSupportFacet extends AbstractSingleSourceListFacet<PCClass, SpellSupportForPCClass> Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/StartingLanguageFacet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/cdom/facet/StartingLanguageFacet.java 2012-02-24 03:15:09 UTC (rev 16278) +++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/StartingLanguageFacet.java 2012-02-24 03:15:54 UTC (rev 16279) @@ -26,7 +26,9 @@ /** * StartingLanguageFacet is a Facet that tracks the Languages that are available - * to a Player Character from the LANGBONUS token + * to a Player Character from the LANGBONUS token. + * + * @author Thomas Parker (thpr [at] yahoo.com) */ public class StartingLanguageFacet extends AbstractSourcedListFacet<Language> implements DataFacetChangeListener<CDOMObject> @@ -41,6 +43,9 @@ private ConditionalTemplateFacet conditionalTemplateFacet; /** + * Adds available Languages to this facet when a CDOMObject added to a + * Player Character makes Languages available to the Player Character. + * * Triggered when one of the Facets to which StartingLanguageFacet listens * fires a DataFacetChangeEvent to indicate a CDOMObject was added to a * Player Character. @@ -68,6 +73,10 @@ } /** + * Removes available Languages from this facet when a CDOMObject removed + * from a Player Character makes Languages available to the Player + * Character. + * * Triggered when one of the Facets to which StartingLanguageFacet listens * fires a DataFacetChangeEvent to indicate a CDOMObject was removed from a * Player Character. @@ -105,6 +114,12 @@ this.conditionalTemplateFacet = conditionalTemplateFacet; } + /** + * Initializes the connections for StartingLanguageFacet to other facets. + * + * This method is automatically called by the Spring framework during + * initialization of the StartingLanguageFacet. + */ public void init() { raceFacet.addDataFacetChangeListener(this); Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatFacet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatFacet.java 2012-02-24 03:15:09 UTC (rev 16278) +++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatFacet.java 2012-02-24 03:15:54 UTC (rev 16279) @@ -30,14 +30,38 @@ import pcgen.core.bonus.BonusUtilities; /** - * StatFacet is a Facet that tracks the PCStat that have been granted to a - * Player Character. + * StatFacet is a Facet that tracks the PCStat objects that have been granted to + * a Player Character. + * + * @author Thomas Parker (thpr [at] yahoo.com) */ public class StatFacet extends AbstractListFacet<PCStat> { private BonusCheckingFacet bonusCheckingFacet; private PrerequisiteFacet prerequisiteFacet; + /* + * TODO I think there needs to be a consideration of whether these two + * methods (below) violate the "a facet should do one thing" principle. With + * the proposed facet organization, these methods might make it ambiguous + * where this facet belongs. + */ + /** + * Returns a non-null Map indicating the bonuses of the given Bonus type and + * given Bonus name, mapped to the PCStat objects which granted the Bonus. + * + * @param id + * The CharID indicating the Player Character on which the + * bonuses for a given Bonus type and Bonus name are to be + * returned + * @param aType + * The Bonus type of the bonuses to be returned + * @param aName + * The Bonus name of the bonuses to be returned + * @return A non-null Map indicating the bonuses of the given Bonus type and + * given Bonus name, mapped to the PCStat objects which granted the + * Bonus + */ public Map<BonusObj, PCStat> getBonusListOfType(CharID id, final String aType, final String aName) { @@ -56,6 +80,24 @@ return aList; } + /** + * Returns the aggregate Bonus value for the given Bonus type and given + * Bonus name which are applied by PCStat objects to the Player Character + * identified by the given CharID. + * + * @param id + * The CharID identifying the Player Character for which the + * aggregate Bonus value is to be calculated + * @param type + * The Bonus type for which the aggregate Bonus value is to be + * calculated + * @param name + * The Bonus name for which the aggregate Bonus value is to be + * calculated + * @return The aggregate Bonus value for the given Bonus type and given + * Bonus name which are applied by PCStat objects to the Player + * Character identified by the given CharID + */ public double getStatBonusTo(CharID id, String type, String name) { final Map<BonusObj, PCStat> map = getBonusListOfType(id, type Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatLockFacet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatLockFacet.java 2012-02-24 03:15:09 UTC (rev 16278) +++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/StatLockFacet.java 2012-02-24 03:15:54 UTC (rev 16279) @@ -32,6 +32,8 @@ /** * StatLockFacet is a Facet that tracks the Stats that have been locked on a * Player Character. + * + * @author Thomas Parker (thpr [at] yahoo.com) */ public class StatLockFacet extends AbstractSourcedListFacet<StatLock> implements DataFacetChangeListener<CDOMObject> @@ -41,6 +43,9 @@ private CDOMObjectConsolidationFacet consolidationFacet; /** + * Adds StatLock objects granted by a CDOMObject which has been added to a + * Player Character. + * * Triggered when one of the Facets to which StatLockFacet listens fires a * DataFacetChangeEvent to indicate a CDOMObject was added to a Player * Character. @@ -63,6 +68,9 @@ } /** + * Removes StatLock objects granted by a CDOMObject which has been removed + * from a Player Character. + * * Triggered when one of the Facets to which StatLockFacet listens fires a * DataFacetChangeEvent to indicate a CDOMObject was removed from a Player * Character. @@ -79,6 +87,21 @@ removeAll(dfce.getCharID(), dfce.getCDOMObject()); } + /** + * Returns the numerical value for the given PCStat which has been locked + * for the Player Character identified by the given CharID. Returns null if + * no StatLock exists on the Player Character for the given PCStat. + * + * @param id + * The CharID identifying the Player Character for which the + * locked stat value is to be returned + * @param stat + * The PCStat for which the numerical lock value is to be + * returned + * @return The numerical value for the given PCStat which has been locked + * for the Player Character identified by the given CharID; null if + * no StatLock exists on the Player Character for the given PCStat + */ public Number getLockedStat(CharID id, PCStat stat) { Number max = Double.NEGATIVE_INFINITY; @@ -123,7 +146,13 @@ { this.consolidationFacet = consolidationFacet; } - + + /** + * Initializes the connections for StatLockFacet to other facets. + * + * This method is automatically called by the Spring framework during + * initialization of the StatLockFacet. + */ public void init() { consolidationFacet.addDataFacetChangeListener(this); Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/SubClassFacet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/cdom/facet/SubClassFacet.java 2012-02-24 03:15:09 UTC (rev 16278) +++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/SubClassFacet.java 2012-02-24 03:15:54 UTC (rev 16279) @@ -1,3 +1,20 @@ +/* + * Copyright (c) Thomas Parker, 2010. + * + * This program 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 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 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package pcgen.cdom.facet; import pcgen.core.PCClass; @@ -2,2 +19,8 @@ +/** + * SubClassFacet stores the SubClass identifier that are applied to a Player + * Character, in relation to the parent PCClass objects. + * + * @author Thomas Parker (thpr [at] yahoo.com) + */ public class SubClassFacet extends Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/SuppressBioFieldFacet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/cdom/facet/SuppressBioFieldFacet.java 2012-02-24 03:15:09 UTC (rev 16278) +++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/SuppressBioFieldFacet.java 2012-02-24 03:15:54 UTC (rev 16279) @@ -30,9 +30,9 @@ import pcgen.cdom.enumeration.CharID; /** - * The Class <code>SuppressBioFieldFacet</code> tracks the biography fields that - * should be hidden from output. - * + * The Class <code>SuppressBioFieldFacet</code> tracks the biography fields that + * should be hidden from output. + * * <br/> * Last Editor: $Author$ * Last Edited: $Date$ @@ -46,12 +46,18 @@ private final Class<?> thisClass = getClass(); + /* + * TODO Can this use AbstractListFacet? (seems like it can) + */ /** * Set whether the field should be hidden from output. * - * @param id The CharID representing the target Player Character - * @param field The BiographyField to set export suppression rules for. - * @param suppress Should the field be hidden from output. + * @param id + * The CharID representing the target Player Character + * @param field + * The BiographyField to set export suppression rules for. + * @param suppress + * Should the field be hidden from output. */ public void setSuppressField(CharID id, BiographyField field, boolean suppress) { @@ -77,9 +83,11 @@ /** * Check whether the field should be hidden from output for the character. - * - * @param id The CharID of the Player Character being queried. - * @param field The BiographyField to set export suppression rules for. + * + * @param id + * The CharID of the Player Character being queried. + * @param field + * The BiographyField to set export suppression rules for. * @return true if the field should not be output, false if it may be. */ public boolean getSuppressField(CharID id, BiographyField field) @@ -89,6 +97,29 @@ return suppressedFields != null && suppressedFields.contains(field); } + /** + * Copies the contents of the SuppressBioFieldFacet from one Player + * Character to another Player Character, based on the given CharIDs + * representing those Player Characters. + * + * This is a method in SuppressBioFieldFacet in order to avoid exposing the + * mutable Map object to other classes. This should not be inlined, as the + * Set is internal information to SuppressBioFieldFacet and should not be + * exposed to other classes. + * + * Note also the copy is a one-time event and no references are maintained + * between the Player Characters represented by the given CharIDs (meaning + * once this copy takes place, any change to the SuppressBioFieldFacet will + * only impact the Player Character where the SuppressBioFieldFacet was + * changed). + * + * @param source + * The CharID representing the Player Character from which the + * information should be copied + * @param destination + * The CharID representing the Player Character to which the + * information should be copied + */ @Override public void copyContents(CharID source, CharID copy) { Modified: Trunk/pcgen/code/src/java/pcgen/cdom/facet/TotalWeightFacet.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/cdom/facet/TotalWeightFacet.java 2012-02-24 03:15:09 UTC (rev 16278) +++ Trunk/pcgen/code/src/java/pcgen/cdom/facet/TotalWeightFacet.java 2012-02-24 03:15:54 UTC (rev 16279) @@ -22,6 +22,13 @@ import pcgen.core.PlayerCharacter; import pcgen.core.RuleConstants; +/** + * TotalWeightFacet performs calculations related to the total weight of + * Equipment carried by a Player Character (does not include the body weight of + * the Player Character). + * + * @author Thomas Parker (thpr [at] yahoo.com) + */ public class TotalWeightFacet { private final PlayerCharacterTrackingFacet trackingFacet = FacetLibrary @@ -29,6 +36,16 @@ private EquipmentFacet equipmentFacet; + /** + * Returns the total Equipment weight for the Player Character identified by + * the given CharID. + * + * @param id + * The CharID identifying the Player Character for which the + * total Equipment weight is to be returned + * @return The total Equipment weight for the Player Character identified by + * the given CharID + */ public Float getTotalWeight(CharID id) { float totalWeight = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |