com.realtime.crossfire.jxclient.skills
Class SkillSet

java.lang.Object
  extended by com.realtime.crossfire.jxclient.skills.SkillSet

public class SkillSet
extends java.lang.Object

Maintain the set of skills as sent by the server.


Field Summary
private  CrossfireSkillInfoListener crossfireSkillInfoListener
          The CrossfireSkillInfoListener attached to the server connection for detecting changed skill info.
private  GuiStateListener guiStateListener
          The GuiStateListener for detecting established or dropped connections.
private  java.util.Map<java.lang.String,Skill> namedSkills
          Maps skill name to skill instance.
private  Skill[] numberedSkills
          Maps stat number to skill instance.
 
Constructor Summary
SkillSet(CrossfireServerConnection crossfireServerConnection, GuiStateManager guiStateManager)
          Creates a new instance.
 
Method Summary
private  void addSkill(int id, java.lang.String skillName)
          Adds a new skill to the list of known skills.
 void clearNumberedSkills()
          Clears all stat info in numberedSkills.
 Skill getNamedSkill(java.lang.String skillName)
          Return the skill instance for a given skill name.
 Skill getSkill(int id)
          Returns the given skill as a Skill object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crossfireSkillInfoListener

@NotNull
private final CrossfireSkillInfoListener crossfireSkillInfoListener
The CrossfireSkillInfoListener attached to the server connection for detecting changed skill info.


guiStateListener

@NotNull
private final GuiStateListener guiStateListener
The GuiStateListener for detecting established or dropped connections.


namedSkills

@NotNull
private final java.util.Map<java.lang.String,Skill> namedSkills
Maps skill name to skill instance.


numberedSkills

@NotNull
private final Skill[] numberedSkills
Maps stat number to skill instance. Entries may be null if the server did not provide a mapping.

Constructor Detail

SkillSet

public SkillSet(@NotNull
                CrossfireServerConnection crossfireServerConnection,
                @NotNull
                GuiStateManager guiStateManager)
Creates a new instance.

Parameters:
crossfireServerConnection - the server connection to monitor
guiStateManager - the gui state manager to watch
Method Detail

addSkill

private void addSkill(int id,
                      @NotNull
                      java.lang.String skillName)
Adds a new skill to the list of known skills.

Parameters:
id - The numerical identifier for the new skill.
skillName - The skill name.

clearNumberedSkills

public void clearNumberedSkills()
Clears all stat info in numberedSkills.


getNamedSkill

public Skill getNamedSkill(java.lang.String skillName)
Return the skill instance for a given skill name.

Parameters:
skillName - The skill name to look up.
Returns:
The skill instance.

getSkill

@Nullable
public Skill getSkill(int id)
Returns the given skill as a Skill object.

Parameters:
id - The numerical skill identifier.
Returns:
The Skill object matching the given identifier; may be null for undefined skills.