|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.NetworkInterface
public abstract class NetworkInterface
Network interface of a DTNHost. Takes care of connectivity among hosts.
Field Summary | |
---|---|
protected java.util.List<Connection> |
connections
|
protected DTNHost |
host
|
protected java.lang.String |
interfacetype
|
protected ConnectivityOptimizer |
optimizer
|
static java.lang.String |
RANGE_ID
ModuleCommunicationBus identifier for the "radio range"
variable. |
static java.lang.String |
SCAN_INTERVAL_ID
ModuleCommunicationBus identifier for the "scanning interval"
variable. |
static java.lang.String |
SCAN_INTERVAL_S
scanning interval -setting id ("scanInterval") |
static java.lang.String |
SPEED_ID
ModuleCommunicationBus identifier for the "transmission speed"
variable. |
static java.lang.String |
TRANSMIT_RANGE_S
transmit range -setting id ("transmitRange") |
static java.lang.String |
TRANSMIT_SPEED_S
transmit speed -setting id ("transmitSpeed") |
protected double |
transmitRange
|
protected int |
transmitSpeed
|
Constructor Summary | |
---|---|
NetworkInterface()
For creating an empty class of a specific type |
|
NetworkInterface(NetworkInterface ni)
copy constructor |
|
NetworkInterface(Settings s)
For creating an empty class of a specific type |
Method Summary | |
---|---|
protected void |
connect(Connection con,
NetworkInterface anotherInterface)
Connects this host to another host. |
abstract void |
connect(NetworkInterface anotherInterface)
Connects the interface to another interface. |
abstract void |
createConnection(NetworkInterface anotherInterface)
Creates a connection to another host. |
void |
destroyConnection(NetworkInterface anotherInterface)
Disconnect a connection between this and another host. |
protected void |
disconnect(Connection con,
NetworkInterface anotherInterface)
Disconnects this host from another host. |
protected void |
ensurePositiveValue(double value,
java.lang.String settingName)
Makes sure that a value is positive |
int |
getAddress()
Returns the network interface address. |
java.util.List<Connection> |
getConnections()
Returns a list of currently connected connections |
DTNHost |
getHost()
Returns the DTNHost of this interface |
java.lang.String |
getInterfaceType()
For checking what interface type this interface is |
Coord |
getLocation()
Returns the current location of the host of this interface. |
double |
getTransmitRange()
Returns the transmit range of this network layer |
int |
getTransmitSpeed()
Returns the transmit speed of this network layer |
protected boolean |
isConnected(NetworkInterface netinterface)
Returns true if the given NetworkInterface is connected to this host. |
boolean |
isScanning()
Checks if this interface is currently in the scanning mode |
protected boolean |
isWithinRange(NetworkInterface anotherInterface)
Returns true if another interface is within radio range of this interface and this interface is also within radio range of the another interface. |
void |
moduleValueChanged(java.lang.String key,
java.lang.Object newValue)
This method is called by the ModuleCommunicationBus when/if
someone changes the scanning interval, transmit speed, or range |
abstract NetworkInterface |
replicate()
Replication function |
static void |
reset()
Resets the static fields of the class |
void |
setClisteners(java.util.List<ConnectionListener> cListeners)
For setting the connectionListeners |
void |
setHost(DTNHost host)
For setting the host - needed when a prototype is copied for several hosts |
java.lang.String |
toString()
Returns a string representation of the object. |
abstract void |
update()
Updates the state of current connections (ie tears down connections that are out of range, recalculates transmission speeds etc.). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TRANSMIT_RANGE_S
public static final java.lang.String TRANSMIT_SPEED_S
public static final java.lang.String SCAN_INTERVAL_S
public static final java.lang.String SCAN_INTERVAL_ID
ModuleCommunicationBus
identifier for the "scanning interval"
variable.
public static final java.lang.String RANGE_ID
ModuleCommunicationBus
identifier for the "radio range"
variable. Value type: double
public static final java.lang.String SPEED_ID
ModuleCommunicationBus
identifier for the "transmission speed"
variable. Value type: integer
protected DTNHost host
protected java.lang.String interfacetype
protected java.util.List<Connection> connections
protected double transmitRange
protected int transmitSpeed
protected ConnectivityOptimizer optimizer
Constructor Detail |
---|
public NetworkInterface(Settings s)
public NetworkInterface()
public NetworkInterface(NetworkInterface ni)
Method Detail |
---|
public static void reset()
public abstract NetworkInterface replicate()
public void setHost(DTNHost host)
host
- The host where the network interface ispublic java.lang.String getInterfaceType()
public void setClisteners(java.util.List<ConnectionListener> cListeners)
cListeners
- List of connection listenerspublic int getAddress()
public double getTransmitRange()
public int getTransmitSpeed()
public java.util.List<Connection> getConnections()
public boolean isScanning()
public abstract void connect(NetworkInterface anotherInterface)
anotherInterface
- The interface to connect toprotected void connect(Connection con, NetworkInterface anotherInterface)
con
- The new connection objectanotherInterface
- The interface to connect toprotected void disconnect(Connection con, NetworkInterface anotherInterface)
con
- The connection to tear downprotected boolean isWithinRange(NetworkInterface anotherInterface)
anotherInterface
- The another interface
protected boolean isConnected(NetworkInterface netinterface)
netinterface
- The other NetworkInterface to check
protected void ensurePositiveValue(double value, java.lang.String settingName)
value
- Value to checksettingName
- Name of the setting (for error's message)
SettingsError
- if the value was not positivepublic abstract void update()
public void moduleValueChanged(java.lang.String key, java.lang.Object newValue)
ModuleCommunicationBus
when/if
someone changes the scanning interval, transmit speed, or range
moduleValueChanged
in interface ModuleCommunicationListener
key
- Identifier of the changed valuenewValue
- New value for the variablepublic abstract void createConnection(NetworkInterface anotherInterface)
connect(NetworkInterface)
).
anotherInterface
- The interface to create the connection topublic void destroyConnection(NetworkInterface anotherInterface)
anotherInterface
- The other host's network interface to disconnect
from this hostpublic DTNHost getHost()
public Coord getLocation()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |