com.realtime.crossfire.jxclient.skills
Class Skill

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

public class Skill
extends java.lang.Object

One skill of the character.


Field Summary
private  long experience
          The skill experience.
private  int level
          The skill level.
private  java.util.Collection<SkillListener> listeners
          The listeners to inform of changes.
private  java.lang.String name
          The skill name.
 
Constructor Summary
Skill(java.lang.String name)
          Creates a new instance.
 
Method Summary
 void addSkillListener(SkillListener listener)
          Adds a listener to be notified of changes.
private  void fireAddSkill()
          Notifies all listeners about a gained skill.
private  void fireDelSkill()
          Notifies all listeners about a lost attribute.
private  void fireEvents(boolean oldKnown)
          Notifies all listeners about changes.
private  void fireUpdSkill()
          Notifies all listeners about an updated attribute.
 long getExperience()
          Returns the skill experience.
 int getLevel()
          Returns the skill level.
private  boolean isKnown()
          Returns whether the skill is known.
 void removeSkillListener(SkillListener listener)
          Removes a listener to be notified of changes.
 void set(int level, long experience)
          Updates the skill attributes.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

experience

private long experience
The skill experience.


level

private int level
The skill level.


listeners

@NotNull
private final java.util.Collection<SkillListener> listeners
The listeners to inform of changes.


name

@NotNull
private final java.lang.String name
The skill name.

Constructor Detail

Skill

public Skill(@NotNull
             java.lang.String name)
Creates a new instance.

Parameters:
name - the skill name
Method Detail

addSkillListener

public void addSkillListener(@NotNull
                             SkillListener listener)
Adds a listener to be notified of changes.

Parameters:
listener - the listener to add

fireAddSkill

private void fireAddSkill()
Notifies all listeners about a gained skill.


fireDelSkill

private void fireDelSkill()
Notifies all listeners about a lost attribute.


fireEvents

private void fireEvents(boolean oldKnown)
Notifies all listeners about changes.

Parameters:
oldKnown - whether the skill was known before the update

fireUpdSkill

private void fireUpdSkill()
Notifies all listeners about an updated attribute.


getExperience

public long getExperience()
Returns the skill experience.

Returns:
the skill experience

getLevel

public int getLevel()
Returns the skill level.

Returns:
the skill level

isKnown

private boolean isKnown()
Returns whether the skill is known.

Returns:
whether the skill is known

removeSkillListener

public void removeSkillListener(@NotNull
                                SkillListener listener)
Removes a listener to be notified of changes.

Parameters:
listener - the listener to remove

set

public void set(int level,
                long experience)
Updates the skill attributes.

Parameters:
level - the new skill level
experience - the new skill experience

toString

@NotNull
public java.lang.String toString()

Overrides:
toString in class java.lang.Object