|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectprefs.VSPrefs
prefs.VSSerializablePrefs
events.VSAbstractEvent
protocols.VSAbstractProtocol
public abstract class VSAbstractProtocol
The class VSAbstractProtocol, this class defined the basic framework of a protocol.
| Field Summary | |
|---|---|
protected static boolean |
HAS_ON_CLIENT_START
The protocol has an onClientStart method |
protected static boolean |
HAS_ON_SERVER_START
The protocol has an onServerStart method |
| Fields inherited from class events.VSAbstractEvent |
|---|
prefs, process |
| Fields inherited from class prefs.VSPrefs |
|---|
BOOLEAN_PREFIX, COLOR_PREFIX, FLOAT_PREFIX, id, INTEGER_PREFIX, LONG_PREFIX, STRING_PREFIX, VECTOR_PREFIX |
| Constructor Summary | |
|---|---|
VSAbstractProtocol(boolean hasOnServerStart)
A simple constructor. |
|
| Method Summary | |
|---|---|
void |
currentContextIsServer(boolean currentContextIsServer)
Sets if the current context is server. |
void |
deserialize(VSSerialize serialize,
java.io.ObjectInputStream objectInputStream)
Deserializes |
int |
getNumProcesses()
Gets the num processes. |
boolean |
hasOnServerStart()
Checks how the protocol will start |
boolean |
isClient()
Checks if is client. |
void |
isClient(boolean isClient)
Sets if is client. |
boolean |
isRelevantMessage(VSMessage message)
Check's if its a relevant message. |
boolean |
isServer()
Checks if is server. |
void |
isServer(boolean isServer)
Sets if is server. |
abstract void |
onClientInit()
On client init. |
abstract void |
onClientRecv(VSMessage message)
On client recv. |
abstract void |
onClientReset()
On client reset. |
abstract void |
onClientSchedule()
On client schedule. |
void |
onClientScheduleStart()
Runs a client schedule |
void |
onClientStart()
On client start. |
void |
onInit()
Every event has its own initialize method. |
void |
onMessageRecvStart(VSMessage message)
On message recv. |
abstract void |
onServerInit()
On server init. |
abstract void |
onServerRecv(VSMessage message)
On server recv. |
abstract void |
onServerReset()
On server reset. |
abstract void |
onServerSchedule()
On server schedule. |
void |
onServerScheduleStart()
Runs a server schedule |
void |
onServerStart()
On server start. |
void |
onStart()
Every event can get started. |
void |
removeSchedules()
Removes all schedules of the protocol (server or client) |
void |
reset()
Resets the protocol. |
void |
scheduleAt(long time)
Reschedules the protocol for a new time and runs onClientSchedule or onServerSchedule |
void |
sendMessage(VSMessage message)
Sends a message. |
void |
serialize(VSSerialize serialize,
java.io.ObjectOutputStream objectOutputStream)
Serializes |
java.lang.String |
toString()
|
| Methods inherited from class events.VSAbstractEvent |
|---|
equals, getClassname, getCopy, getCopy, getName, getProcess, getShortname, init, init, log, setClassname, setShortname |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final boolean HAS_ON_SERVER_START
protected static final boolean HAS_ON_CLIENT_START
| Constructor Detail |
|---|
public VSAbstractProtocol(boolean hasOnServerStart)
hasOnServerStart - true, if the protocol uses an onServerStart
method. false, if the protocol uses an onClientStart method instead.| Method Detail |
|---|
public void sendMessage(VSMessage message)
message - the message to sendpublic final void onStart()
VSAbstractEvent
onStart in class VSAbstractEventpublic final void onInit()
VSAbstractEvent
onInit in class VSAbstractEventpublic final void onClientScheduleStart()
public final void onServerScheduleStart()
public final void onMessageRecvStart(VSMessage message)
message - the messagepublic final boolean isRelevantMessage(VSMessage message)
message - the message to check
public final void currentContextIsServer(boolean currentContextIsServer)
currentContextIsServer - the context.public final boolean hasOnServerStart()
public final void isServer(boolean isServer)
isServer - the is serverpublic final boolean isServer()
public final void isClient(boolean isClient)
isClient - the is clientpublic final boolean isClient()
public void reset()
public final void scheduleAt(long time)
time - The process' local time to run the schedule at.public final void removeSchedules()
public abstract void onClientInit()
public void onClientStart()
public abstract void onClientReset()
public abstract void onClientSchedule()
public abstract void onClientRecv(VSMessage message)
message - the messagepublic abstract void onServerInit()
public void onServerStart()
public abstract void onServerReset()
public abstract void onServerRecv(VSMessage message)
message - the messagepublic abstract void onServerSchedule()
public final int getNumProcesses()
public java.lang.String toString()
toString in class VSPrefs
public void serialize(VSSerialize serialize,
java.io.ObjectOutputStream objectOutputStream)
throws java.io.IOException
VSSerializable
serialize in interface VSSerializableserialize in class VSAbstractEventserialize - The serialize objectobjectOutputStream - The object output stream
java.io.IOException
public void deserialize(VSSerialize serialize,
java.io.ObjectInputStream objectInputStream)
throws java.io.IOException,
java.lang.ClassNotFoundException
VSSerializable
deserialize in interface VSSerializabledeserialize in class VSAbstractEventserialize - The serialize objectobjectInputStream - The object input stream
java.io.IOException
java.lang.ClassNotFoundException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||