public class AddrPortListMgr extends ErrorMessageMgr
Modifier and Type | Class and Description |
---|---|
static class |
AddrPortListMgr.EntryBlock
Class EntryBlock holds a host-address string and a port number value.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector |
entriesVec |
protected boolean |
keepDefaultServersFlag |
protected DataChangedListener |
listCommitListenerObj |
protected java.util.Random |
randomObj |
protected static char |
sepCh |
Constructor and Description |
---|
AddrPortListMgr()
Creates a manager for a list of host-address/port-number entries,
with the list initially empty.
|
AddrPortListMgr(java.lang.String dataListStr)
Creates a manager for a list of host-address/port-number entries,
interprets the given data list string into host-address/port-number
entries and adds them to the end of the list.
|
AddrPortListMgr(java.lang.String dataListStr,
char itemSepChar)
Creates a manager for a list of host-address/port-number entries,
interprets the given data list string into host-address/port-number
entries and adds them to the end of the list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addEntriesListStr(java.lang.String dataListStr)
Interprets the given data list string into host-address/port-number
entries and adds them to the end of the list.
|
boolean |
addEntriesListStr(java.lang.String dataListStr,
char itemSepChar)
Interprets the given data list string into host-address/port-number
entries and adds them to the end of the list.
|
boolean |
addEntry(AddrPortListMgr.EntryBlock blkObj)
Adds a host-address/port-number entry to the end of the list.
|
boolean |
addEntry(java.lang.String dataStr)
Interprets the given data string into a host address and port number
and adds a new entry with the values to the end of the list.
|
boolean |
addEntry(java.lang.String addrStr,
int portNum)
Adds a host-address/port-number entry to the end of the list.
|
void |
clearAllEntries()
Removes all entries from the list.
|
boolean |
contains(AddrPortListMgr.EntryBlock blkObj)
Determines whether or not an entry with the same host-address and
port-number exists in the list.
|
boolean |
equalsFirstEntry(java.lang.String hostAddr,
int portNum)
Compares the given host-address/port-number to those held by the
first entry in the list.
|
void |
fireListCommit(java.lang.Object sourceObj)
Indicates that the contents of the list should be "committed".
|
java.lang.String |
getEntriesListStr()
Returns a data list string containing the host-name/port-number
entries in this list.
|
java.lang.String |
getEntriesListStr(boolean randomFlag)
Returns a data list string containing the host-name/port-number
entries in this list.
|
java.lang.String |
getEntriesListStr(char itemSepChar)
Returns a data list string containing the host-name/port-number
entries in this list.
|
java.lang.String |
getEntriesListStr(char itemSepChar,
boolean randomFlag)
Returns a data list string containing the host-name/port-number
entries in this list.
|
AddrPortListMgr.EntryBlock |
getEntry(int idx)
Returns the host-address/port-number entry at the given index in the
list.
|
boolean |
getKeepDefaultServersFlag()
Returns the 'keepDefaultServersFlag' flag.
|
static char |
getSeparatorChar()
Returns the host-address/port-number separator character.
|
AddrPortListMgr.EntryBlock |
parseEntry(java.lang.String dataStr)
Interprets the given data string into a host address and port number
and creates and entry data block containing the values.
|
java.lang.String |
popAllEntries()
Removes and returns all entries in this list.
|
java.lang.String |
popAllEntries(char itemSepChar)
Removes and returns all entries in this list.
|
AddrPortListMgr.EntryBlock |
popFirstAndAddEntry(AddrPortListMgr.EntryBlock blkObj)
Fetches the first entry and deletes it from the list and then
adds a host-address/port-number entry to the end of the list.
|
AddrPortListMgr.EntryBlock |
popFirstAndAddEntry(java.lang.String addrStr,
int portNum)
Fetches the first entry and deletes it from the list and then
adds a host-address/port-number entry to the end of the list.
|
AddrPortListMgr.EntryBlock |
popFirstEntry()
Fetches the first entry and deletes it from the list.
|
AddrPortListMgr.EntryBlock |
popRandomEntry()
Fetches a randomly-selected entry and deletes it from the list.
|
boolean |
removeEntry(AddrPortListMgr.EntryBlock blkObj)
Removes the given host-address/port-number entry.
|
AddrPortListMgr.EntryBlock |
removeEntry(java.lang.String addrStr,
int portNum)
Removes the given host-address/port-number entry.
|
boolean |
setEntriesListStr(java.lang.String dataListStr)
Clears any current entries; then interprets the given data list
string into host-address/port-number entries and adds them to the
end of the list.
|
boolean |
setEntriesListStr(java.lang.String dataListStr,
char itemSepChar)
Clears any current entries; then interprets the given data list
string into host-address/port-number entries and adds them to the
end of the list.
|
void |
setKeepDefaultServersFlag(boolean flgVal)
Sets the 'keepDefaultServersFlag' flag.
|
void |
setListCommitListenerObj(DataChangedListener listenerObj)
Enters the call-back listener to be called when the 'fireListCommit()'
method is invoke.
|
static void |
setSeparatorChar(char ch)
Sets the host-address/port-number separator character.
|
int |
size()
Returns the number of host-address/port-number entries in the list.
|
clearErrorMessageString, clearFetchedErrorMessage, enterErrorMessageString, getErrorMessageFlag, getErrorMessageString, getUnfetchedMessageFlag, setErrorMessageString
protected static char sepCh
protected final java.util.Vector entriesVec
protected DataChangedListener listCommitListenerObj
protected boolean keepDefaultServersFlag
protected final java.util.Random randomObj
public AddrPortListMgr()
public AddrPortListMgr(java.lang.String dataListStr, char itemSepChar)
dataListStr
- a data list string in the form
"hostAddr:portNum,hostAddr:portNum,...", where ':' is the
separator character defined via the 'setSeparatorChar()' method
(default is ':') and ',' is the item-separator character defined
by the 'itemSepChar' parameter.itemSepChar
- the item separator character.public AddrPortListMgr(java.lang.String dataListStr)
dataListStr
- a data list string in the form
"hostAddr:portNum,hostAddr:portNum,...", where ':' is the
separator character defined via the 'setSeparatorChar()' method
(default is ':').public AddrPortListMgr.EntryBlock parseEntry(java.lang.String dataStr)
dataStr
- a data string in the form "hostAddr:portNum", where
':' is the separator character defined via the 'setSeparatorChar()'
method (default is ':').public boolean contains(AddrPortListMgr.EntryBlock blkObj)
blkObj
- the host-address/port-number data-block to add.public boolean addEntry(AddrPortListMgr.EntryBlock blkObj)
blkObj
- the host-address/port-number data-block to use.public boolean addEntry(java.lang.String addrStr, int portNum)
addrStr
- the host address to use.portNum
- the port number to use.public boolean addEntry(java.lang.String dataStr)
dataStr
- a data string in the form "hostAddr:portNum", where
':' is the separator character defined via the 'setSeparatorChar()'
method (default is ':').public final boolean addEntriesListStr(java.lang.String dataListStr, char itemSepChar)
dataListStr
- a data list string in the form
"hostAddr:portNum,hostAddr:portNum,...", where ':' is the
separator character defined via the 'setSeparatorChar()' method
(default is ':') and ',' is the item-separator character defined
by the 'itemSepChar' parameter.itemSepChar
- the item separator character.public final boolean addEntriesListStr(java.lang.String dataListStr)
dataListStr
- a data list string in the form
"hostAddr:portNum,hostAddr:portNum,...", where ':' is the
separator character defined via the 'setSeparatorChar()' method
(default is ':').public boolean setEntriesListStr(java.lang.String dataListStr, char itemSepChar)
dataListStr
- a data list string in the form
"hostAddr:portNum,hostAddr:portNum,...", where ':' is the
separator character defined via the 'setSeparatorChar()' method
(default is ':') and ',' is the item-separator character defined
by the 'itemSepChar' parameter.itemSepChar
- the item separator character.public boolean setEntriesListStr(java.lang.String dataListStr)
dataListStr
- a data list string in the form
"hostAddr:portNum,hostAddr:portNum,...", where ':' is the
separator character defined via the 'setSeparatorChar()' method
(default is ':').public int size()
public boolean removeEntry(AddrPortListMgr.EntryBlock blkObj)
blkObj
- the host-address/port-number entry to remove.public AddrPortListMgr.EntryBlock removeEntry(java.lang.String addrStr, int portNum)
addrStr
- the host address to use.portNum
- the port number to use.public void clearAllEntries()
public AddrPortListMgr.EntryBlock getEntry(int idx)
idx
- the index into the list to use.public AddrPortListMgr.EntryBlock popFirstEntry()
public AddrPortListMgr.EntryBlock popFirstAndAddEntry(AddrPortListMgr.EntryBlock blkObj)
blkObj
- the host-address/port-number data-block to add.public AddrPortListMgr.EntryBlock popFirstAndAddEntry(java.lang.String addrStr, int portNum)
addrStr
- the host address to use.portNum
- the port number to use.public AddrPortListMgr.EntryBlock popRandomEntry()
public boolean equalsFirstEntry(java.lang.String hostAddr, int portNum)
hostAddr
- the host address to use.portNum
- the port number to use.public java.lang.String getEntriesListStr(char itemSepChar, boolean randomFlag)
itemSepChar
- the item separator character.randomFlag
- true to return the entries in random order;
false to return the entries in order as entered.public java.lang.String getEntriesListStr(char itemSepChar)
itemSepChar
- the item separator character.public java.lang.String getEntriesListStr(boolean randomFlag)
randomFlag
- true to return the entries in random order;
false to return the entries in order as entered.public java.lang.String getEntriesListStr()
public java.lang.String popAllEntries(char itemSepChar)
itemSepChar
- the item separator character.public java.lang.String popAllEntries()
public void setListCommitListenerObj(DataChangedListener listenerObj)
listenerObj
- the call-back listener to use, or null to clear
any current listener.public void fireListCommit(java.lang.Object sourceObj)
sourceObj
- the source object to be passed along to the call-back
listener.public static void setSeparatorChar(char ch)
ch
- the separator character to use.public static char getSeparatorChar()
public void setKeepDefaultServersFlag(boolean flgVal)
flgVal
- the flag value to use.public boolean getKeepDefaultServersFlag()