Search in sources :

Example 6 with Capacity

use of pcgen.cdom.helper.Capacity in project pcgen by PCGen.

the class Equipment method updateContainerCapacityString.

/**
	 * Creates the containerCapacityString from children of this object
	 */
private void updateContainerCapacityString() {
    final StringBuilder tempStringBuilder = new StringBuilder(100);
    boolean comma = false;
    BigDecimal weightCap = get(ObjectKey.CONTAINER_WEIGHT_CAPACITY);
    if (weightCap != null && !Capacity.UNLIMITED.equals(weightCap)) {
        tempStringBuilder.append(weightCap).append(' ').append(Globals.getGameModeUnitSet().getWeightUnit());
        comma = true;
    }
    List<Capacity> capacity = getListFor(ListKey.CAPACITY);
    if (capacity != null) {
        for (Capacity c : capacity) {
            if (comma) {
                tempStringBuilder.append(", ");
                comma = false;
            }
            BigDecimal capValue = c.getCapacity();
            if (!Capacity.UNLIMITED.equals(capValue)) {
                tempStringBuilder.append(capValue).append(' ');
                tempStringBuilder.append(c.getType());
                comma = true;
            } else if (c.getType() != null) {
                comma = true;
                tempStringBuilder.append(c.getType());
            }
        }
    }
    containerCapacityString = tempStringBuilder.toString();
}
Also used : Capacity(pcgen.cdom.helper.Capacity) BigDecimal(java.math.BigDecimal)

Aggregations

Capacity (pcgen.cdom.helper.Capacity)6 BigDecimal (java.math.BigDecimal)5 StringTokenizer (java.util.StringTokenizer)1 FixedSizeFormula (pcgen.cdom.formula.FixedSizeFormula)1 Equipment (pcgen.core.Equipment)1 EquipmentModifier (pcgen.core.EquipmentModifier)1 GameMode (pcgen.core.GameMode)1 PCClass (pcgen.core.PCClass)1 PCTemplate (pcgen.core.PCTemplate)1 PlayerCharacter (pcgen.core.PlayerCharacter)1 Race (pcgen.core.Race)1 RuleCheck (pcgen.core.RuleCheck)1 SizeAdjustment (pcgen.core.SizeAdjustment)1 WeaponProf (pcgen.core.WeaponProf)1 BonusObj (pcgen.core.bonus.BonusObj)1 EquipSet (pcgen.core.character.EquipSet)1 WieldCategory (pcgen.core.character.WieldCategory)1 Prerequisite (pcgen.core.prereq.Prerequisite)1 AbstractReferenceContext (pcgen.rules.context.AbstractReferenceContext)1 LoadContext (pcgen.rules.context.LoadContext)1