public class Skill
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private long |
experience
The skill experience.
|
private int |
face
The skill's face number.
|
private int |
level
The skill level.
|
private EventListenerList2<SkillListener> |
listeners
The listeners to inform of changes.
|
private java.lang.String |
name
The skill name.
|
Constructor and Description |
---|
Skill(java.lang.String name)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
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 |
getFace()
Returns the skill's face.
|
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.
|
void |
setFace(int face)
Defines the skill's face.
|
java.lang.String |
toString() |
private long experience
private int face
private int level
@NotNull private final EventListenerList2<SkillListener> listeners
@NotNull private final java.lang.String name
public Skill(@NotNull java.lang.String name)
name
- the skill namepublic void addSkillListener(@NotNull SkillListener listener)
listener
- the listener to addprivate void fireAddSkill()
private void fireDelSkill()
private void fireEvents(boolean oldKnown)
oldKnown
- whether the skill was known before the updateprivate void fireUpdSkill()
public long getExperience()
public int getFace()
public int getLevel()
private boolean isKnown()
public void removeSkillListener(@NotNull SkillListener listener)
listener
- the listener to removepublic void set(int level, long experience)
level
- the new skill levelexperience
- the new skill experiencepublic void setFace(int face)
face
- new face index.@NotNull public java.lang.String toString()
toString
in class java.lang.Object