com.huguesjohnson.tiamat
Class SkillCollection

java.lang.Object
  extended bycom.huguesjohnson.tiamat.SkillCollection

public class SkillCollection
extends java.lang.Object

SkillCollection - used to store a collection of skills

Author:
Hugues Johnson

Constructor Summary
SkillCollection()
           
SkillCollection(Skill[] skills)
           
SkillCollection(Skill[] skills, java.lang.String pathDelimiter)
           
SkillCollection(java.lang.String pathDelimiter)
           
 
Method Summary
 void adjustAllSkills(int percentage)
          adjusts the values of all Skills in the collection by the given percentage, useful for updating all Skills uniformly for gaining/losing a level
 void adjustSkills(java.lang.String rootPath, int percentage)
          adjusts the values of all Skills under the rootPath by the given percentage, useful for updating all Skills uniformly for gaining/losing a level
 Skill[] getAll()
          return all Skills in the collection
 Skill getAttribute(java.lang.String path)
          return the Skill with that name if it exists, otherwise null
 int getCount()
          returns the total number of Skills in the collection
 int getCount(java.lang.String path)
          returns the total number of Skills starting from the path
 Skill[] getModifiersFor(java.lang.String targetPath)
          return an array of all Skills that have a target with a targetPath equal to targetPath
 int getNetModification(java.lang.String targetPath)
          use getModifiersFor() to get all the modifiers for a target, return the sum of their values
 boolean removeSkill(java.lang.String path)
          return success
 void setAttribute(java.lang.String path, Skill skill)
          sets the Skill with the given path, adds it if it doesn’t exist
 java.lang.String toString()
          returns a string representation of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SkillCollection

public SkillCollection()

SkillCollection

public SkillCollection(java.lang.String pathDelimiter)

SkillCollection

public SkillCollection(Skill[] skills)

SkillCollection

public SkillCollection(Skill[] skills,
                       java.lang.String pathDelimiter)
Method Detail

removeSkill

public boolean removeSkill(java.lang.String path)
return success


getAttribute

public Skill getAttribute(java.lang.String path)
return the Skill with that name if it exists, otherwise null


setAttribute

public void setAttribute(java.lang.String path,
                         Skill skill)
sets the Skill with the given path, adds it if it doesn’t exist


getCount

public int getCount()
returns the total number of Skills in the collection


getCount

public int getCount(java.lang.String path)
returns the total number of Skills starting from the path


getModifiersFor

public Skill[] getModifiersFor(java.lang.String targetPath)
return an array of all Skills that have a target with a targetPath equal to targetPath


getNetModification

public int getNetModification(java.lang.String targetPath)
use getModifiersFor() to get all the modifiers for a target, return the sum of their values


adjustAllSkills

public void adjustAllSkills(int percentage)
adjusts the values of all Skills in the collection by the given percentage, useful for updating all Skills uniformly for gaining/losing a level


adjustSkills

public void adjustSkills(java.lang.String rootPath,
                         int percentage)
adjusts the values of all Skills under the rootPath by the given percentage, useful for updating all Skills uniformly for gaining/losing a level


getAll

public Skill[] getAll()
return all Skills in the collection


toString

public java.lang.String toString()
returns a string representation of the object