public class CharacterModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Integer,EventListenerList2<CharacterInformationListener>> |
characterInformationListeners
All registered character entry listeners.
|
private EventListenerList2<CharacterListener> |
characterListeners
All registered character listeners.
|
private java.util.List<CharacterInformation> |
characters
The current entries.
|
private java.util.Collection<CharacterInformation> |
charactersPending
The pending entries.
|
private java.lang.Object |
sync
Object used for synchronization.
|
Constructor and Description |
---|
CharacterModel() |
Modifier and Type | Method and Description |
---|---|
void |
add(CharacterInformation characterInformation)
Adds an entry.
|
void |
addCharacterInformationListener(int index,
CharacterInformationListener listener)
Adds a character entry listener for one entry.
|
void |
addCharacterListener(CharacterListener listener)
Adds a character listener.
|
void |
begin()
Starts an update transaction.
|
void |
commit()
Finishes an update transaction.
|
boolean |
displaysFace(int faceNum)
Returns whether any character has the given face.
|
int |
getCharacterIndex(java.lang.String characterName)
Returns the index of an entry by character name.
|
private EventListenerList2<CharacterInformationListener> |
getCharacterInformationListeners(int index)
Returns the character entry listeners for one entry index.
|
CharacterInformation |
getEntry(int index)
Returns a character entry by index.
|
void |
removeCharacterInformationListener(int index,
CharacterInformationListener listener)
Removes a character entry listener for one entry.
|
void |
removeCharacterListener(CharacterListener listener)
Removes a character listener.
|
int |
size()
Returns the number of character entries.
|
@NotNull private final java.util.Map<java.lang.Integer,EventListenerList2<CharacterInformationListener>> characterInformationListeners
@NotNull private final EventListenerList2<CharacterListener> characterListeners
@NotNull private final java.util.List<CharacterInformation> characters
@NotNull private final java.util.Collection<CharacterInformation> charactersPending
@NotNull private final java.lang.Object sync
public void add(@NotNull CharacterInformation characterInformation)
characterInformation
- the entry to addpublic void addCharacterInformationListener(int index, @NotNull CharacterInformationListener listener)
index
- the entry index to monitorlistener
- the listener to addpublic void addCharacterListener(@NotNull CharacterListener listener)
listener
- the listener to addpublic void begin()
public void commit()
public boolean displaysFace(int faceNum)
faceNum
- the facepublic int getCharacterIndex(@NotNull java.lang.String characterName)
characterName
- the character name-1
if not found@NotNull private EventListenerList2<CharacterInformationListener> getCharacterInformationListeners(int index)
index
- the entry index@Nullable public CharacterInformation getEntry(int index)
index
- the indexnull
if the index is invalidpublic void removeCharacterInformationListener(int index, @NotNull CharacterInformationListener listener)
index
- the entry index to monitorlistener
- the listener to removepublic void removeCharacterListener(@NotNull CharacterListener listener)
listener
- the listener to removepublic int size()