java.lang.Object com.realtime.crossfire.jxclient.metaserver.MetaserverModel
public class MetaserverModel
Maintains the metaserver information.
Field Summary | |
---|---|
private java.util.List<MetaserverEntry> |
metaList
The current entries. |
private java.util.Collection<MetaserverEntry> |
metaListPending
The pending entries. |
private java.util.Map<java.lang.Integer,java.util.List<MetaserverEntryListener>> |
metaserverEntryListeners
All registered metaserver entry listeners. |
private java.util.Collection<MetaserverListener> |
metaserverListeners
All registered metaserver listeners. |
private java.lang.Object |
sync
Object used for synchronization. |
Constructor Summary | |
---|---|
MetaserverModel()
|
Method Summary | |
---|---|
void |
add(MetaserverEntry metaserverEntry)
Adds an entry. |
void |
addMetaserverEntryListener(int index,
MetaserverEntryListener listener)
Adds a metaserver entry listener for one entry. |
void |
addMetaserverListener(MetaserverListener listener)
Adds a metaserver listener. |
void |
begin()
Starts an update transaction. |
void |
commit()
Finishes an update transaction. |
MetaserverEntry |
getEntry(int index)
Returns a metaserver entry by index. |
private java.util.Collection<MetaserverEntryListener> |
getMetaserverEntryListeners(int index)
Returns the metaserver entry listeners for one entry index. |
int |
getServerIndex(java.lang.String serverName)
Returns the index of an entry by server name. |
void |
removeMetaserverEntryListener(int index,
MetaserverEntryListener listener)
Removes a metaserver entry listener for one entry. |
void |
removeMetaserverListener(MetaserverListener listener)
Removes a metaserver listener. |
int |
size()
Returns the number of metaserver entries. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final java.util.List<MetaserverEntry> metaList
@NotNull private final java.util.Collection<MetaserverEntry> metaListPending
begin()
and commit()
.
@NotNull private final java.util.Map<java.lang.Integer,java.util.List<MetaserverEntryListener>> metaserverEntryListeners
@NotNull private final java.util.Collection<MetaserverListener> metaserverListeners
@NotNull private final java.lang.Object sync
Constructor Detail |
---|
public MetaserverModel()
Method Detail |
---|
public void add(@NotNull MetaserverEntry metaserverEntry)
metaserverEntry
- the entry to addpublic void addMetaserverEntryListener(int index, @NotNull MetaserverEntryListener listener)
index
- the entry index to monitorlistener
- the listener to addpublic void addMetaserverListener(@NotNull MetaserverListener listener)
listener
- the listener to addpublic void begin()
public void commit()
@Nullable public MetaserverEntry getEntry(int index)
index
- the index
null
if the index is
invalid@NotNull private java.util.Collection<MetaserverEntryListener> getMetaserverEntryListeners(int index)
index
- the entry index
public int getServerIndex(@NotNull java.lang.String serverName)
serverName
- the server name
-1
if not foundpublic void removeMetaserverEntryListener(int index, @NotNull MetaserverEntryListener listener)
index
- the entry index to monitorlistener
- the listener to removepublic void removeMetaserverListener(@NotNull MetaserverListener listener)
listener
- the listener to removepublic int size()