|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvisidia.simulation.process.algorithm.Algorithm
public abstract class Algorithm
This is the abstract base class representing an algorithm in visidia. It is the API to be used to implement new algorithms (extending Algorithm class).
| Field Summary | |
|---|---|
protected MessageProcess |
proc
The process. |
| Constructor Summary | |
|---|---|
Algorithm()
|
|
| Method Summary | |
|---|---|
abstract java.lang.Object |
clone()
|
protected int |
getArity()
Returns the node arity (its degree, or number of neighbors). |
java.lang.String |
getDescription()
Gets the description. |
protected java.lang.Object |
getEdgeProperty(int door,
java.lang.Object key)
Gets the edge property value. |
protected int |
getId()
Returns the node identity. |
java.util.Collection<MessageType> |
getMessageTypeList()
Gets the message type list. |
protected int |
getNetSize()
Gets the net size. |
protected java.util.Enumeration<java.lang.Integer> |
getOrientedDoors()
Gets the oriented doors of the current node. |
protected java.lang.Object |
getProperty(java.lang.String key)
Gets the node property value associated to the key. |
abstract void |
init()
This method is executed by the node. |
protected boolean |
isIncomingDoor(int door)
Returns true if the door corresponds to an edge pointing to the current node. |
protected boolean |
isOutgoingDoor(int door)
Returns true if the door corresponds to an edge leaving the current node. |
protected void |
putProperty(java.lang.String key,
java.lang.Object value)
Put property. |
protected void |
putProperty(java.lang.String key,
java.lang.Object value,
int status)
Adds a property to this node. |
protected Message |
receive(Door door)
Gets the first message arriving on the node. |
protected Message |
receiveFrom(int door)
Gets the first message arriving on target door. |
protected Message |
receiveFrom(int door,
MessageCriterion mc)
Gets the first message arriving on target door that matches the criterion. |
void |
run()
This method is used at the thread instantiation. |
protected void |
sendAll(Message msg)
Sends the message message to all neighbors. |
protected boolean |
sendTo(int door,
Message msg)
Sends the message message on target door. |
protected void |
setDoorState(EdgeState st,
int door)
Sets the door state. |
protected void |
setEdgeProperty(int door,
java.lang.Object key,
java.lang.Object value)
Sets the edge property. |
void |
setMessageProcess(MessageProcess proc)
Sets the message process. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected transient MessageProcess proc
| Constructor Detail |
|---|
public Algorithm()
| Method Detail |
|---|
public abstract java.lang.Object clone()
clone in class java.lang.Objectpublic abstract void init()
public java.lang.String getDescription()
public java.util.Collection<MessageType> getMessageTypeList()
protected final int getArity()
protected final int getId()
protected final int getNetSize()
protected final java.util.Enumeration<java.lang.Integer> getOrientedDoors()
protected final boolean isIncomingDoor(int door)
door - the door
protected final boolean isOutgoingDoor(int door)
door - the door
protected final void putProperty(java.lang.String key,
java.lang.Object value,
int status)
value is null the property is removed.
key - the keyvalue - the valuestatus - the status
protected final void putProperty(java.lang.String key,
java.lang.Object value)
key - the keyvalue - the valueprotected final java.lang.Object getProperty(java.lang.String key)
key - the key
protected final java.lang.Object getEdgeProperty(int door,
java.lang.Object key)
door - the doorkey - the key
protected final void setEdgeProperty(int door,
java.lang.Object key,
java.lang.Object value)
door - the doorkey - the keyvalue - the value
protected final void setDoorState(EdgeState st,
int door)
st - the new statedoor - the door
protected boolean sendTo(int door,
Message msg)
door - the doormsg - the message
protected final void sendAll(Message msg)
msg - the messageprotected final Message receiveFrom(int door)
door - the door
protected final Message receiveFrom(int door,
MessageCriterion mc)
door - the doormc - the message criterion
protected Message receive(Door door)
door - the door
public void setMessageProcess(MessageProcess proc)
proc - the new message processpublic final void run()
run in interface java.lang.Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||