All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----simu.sned.sne
The sne class contains information about Simulated Network Elements (SNEs). It is used as a component of the SNED (Simulated Network Element Database - see sned.java). Each SNE defined in the SNED has a corresponding sne object (a one-to-one relationship).
The methods of this class are called from other methods in the sned class. Thus the user (of a sned object) never calls methods or accesses data directly within the sne class. The methods are as follows:
The sne object is a Hashtable which contains several key-value pairs that are relevant to SNE's. The allowable data has been hard-coded in the methods, so the user cannot add new keys or remove any of the standard keys from the Hashtable. This approach was taken to facilitate the modification of the data set of which the SNE is composed. Care must be taken to ensure that methods are updated to reflect any changes to the sne class data set (referred to as "pre-defined keys and values" in the method descriptions below).
An important part of the sne class data set is the "links" Hashtable. Each SNE may be linked to one or more SNEs in the simulated network. The "links" key in the sne object has a corresponding value which is a pointer to a links Hashtable. The data in the links Hashtable are only accessible from the sne class methods.
public sne(String SimIP, int SimPort, String RealIP, int RealPort)
Preconditions: None.
Postconditions: The empty SNED Hashtable exists.
public Object get(String key)
Preconditions: The sne constructor has been called.
Postconditions: The value corresponding to the key in the sne Hashtable is returned as an Object. If the key does not exist in the Hashtable, null is returned. Note that the links Hashtable should not be directly accessible from callers, so null is returned if it is asked for.
public boolean put(String key, Object value)
Preconditions: The sne constructor has been called.
Postconditions: The value is modified for one of the pre-defined keys in the sne HashTable. If the key parameter is not one of the pre-defined keys, false is returned, otherwise true is returned.
The pre-defined keys in the sneTable are:
public String getLink(String SNEid)
Preconditions: The sne constructor has been called.
Postconditions: The link status of the specified link is returned. If the link does not exist, null is returned.
public synchronized Hashtable getLinksTable()
Preconditions: The links Hashtable exists.
Postconditions: A deep copy of the links Hashtable is returned.
This method allows a caller to get access to a copy of the links Hashtable, without allowing the caller to modify the real links Hashtable, which would violate data hiding principles.
public boolean setLink(String SNEid, String linkStatus)
Preconditions: The sne constructor has been called.
Postconditions: The link status of the specified link
is set. If the link does not exist,
the link is created in the Hashtable
with SNEid as the key and linkStatus
as the value.
If the link status is not "UP" or "DOWN",
false is returned, otherwise true is
returned.
public boolean removeLink(String SNEid)
Preconditions: The sne constructor has been called.
Postconditions: If the link exists in the links Hashtable, it is removed and true is returned, otherwise false is returned.
All Packages Class Hierarchy This Package Previous Next Index