Class simu.sned.sne
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class simu.sned.sne

java.lang.Object
   |
   +----simu.sned.sne

public class sne
extends Object
Version:
1.0 27-Feb-97
Author:
Andre Campeau

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:

For more information, see the method descriptions included with the methods.

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.


Constructor Index

 o sne(String, int, String, int)
The sne constructor creates the SNE object and populates all fields.

Method Index

 o get(String)
The get method returns a value from the sne Hashtable.
 o getLink(String)
The getLink method returns the link status of the specified link.
 o getLinksTable()
The getLinksTable method returns a copy of the links Hashtable.
 o put(String, Object)
The put method changes a value in the sne Hashtable.
 o removeLink(String)
The removeLink method removes the specified link from the links Hashtable.
 o setLink(String, String)
The setLink method sets the link status of the specified link.

Constructors

 o sne
  public sne(String SimIP,
             int SimPort,
             String RealIP,
             int RealPort)
The sne constructor creates the SNE object and populates all fields. An empty links Hashtable is created.

Preconditions: None.

Postconditions: The empty SNED Hashtable exists.

Parameters:
SimIP - The Simulated IP Address.
SimPort - The Simulated port.
RealIP - The Real IP Address.
RealPort - The Real port.

Methods

 o get
  public Object get(String key)
The get method returns a value from the sne Hashtable.

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.

Parameters:
key - The Hashtable lookup key.
 o put
  public boolean put(String key,
                     Object value)
The put method changes a value in the sne Hashtable.

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:

Parameters:
key - The Hashtable key.
value - The Hashtable value; an Object.
 o getLink
  public String getLink(String SNEid)
The getLink method returns the link status of the specified link.

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.

Parameters:
SNEid - The SNE identifier.
 o getLinksTable
  public synchronized Hashtable getLinksTable()
The getLinksTable method returns a copy of the links Hashtable.

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.

 o setLink
  public boolean setLink(String SNEid,
                         String linkStatus)
The setLink method sets the link status of the specified link.

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.

Parameters:
SNEid - The SNE identifier.
 o removeLink
  public boolean removeLink(String SNEid)
The removeLink method removes the specified link from the links Hashtable.

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.

Parameters:
SNEid - The SNE identifier.

All Packages  Class Hierarchy  This Package  Previous  Next  Index