public abstract class MessageEvent extends RmiEvent
RmiEvent, which Message is a
subclass of.
Example:
MOVE_TELESCOPE 1 965054152000 SCS
314.745656 12.983457
| Modifier and Type | Field and Description |
|---|---|
private int |
lineNr
The number of command lines.
|
static char |
SEPCHAR
The separator char used in the header.
|
private long |
time
The time of creation.
|
private String |
type
The Message type.
|
private boolean |
valid
True if the message event is valid, i.e.
|
localHost, sourceNamesource| Modifier | Constructor and Description |
|---|---|
protected |
MessageEvent(Object src)
An empty Message.
|
protected |
MessageEvent(Object src,
String type)
An empty Message.
|
protected |
MessageEvent(Object src,
String ty,
long ti)
An empty Message.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkType(String type)
A method that checks if the stated type is in the allowed range.
|
boolean |
equals(Object that)
Tests for equality of two Messages.
|
boolean |
equalTime(long ti)
Test this Messages generation time against the specified time (in ms).
|
boolean |
equalTime(MessageEvent that)
Test whether two MessageEvents have the same generation time.
|
static MessageEvent |
fromAscii(MessageBin ascii)
Converts a
MessageBin into a fully functional java object. |
String |
getAllCommandLines()
A convenience method to return all command lines as a single String.
|
Object |
getExecuteGroupKey()
Returns a simple key for use in a hash table.
|
String |
getHead()
Returns the first line of this Message's String representation.
|
abstract String[] |
getLine()
Returns the command line(s).
|
int |
getNr()
Returns the number of command lines.
|
long |
getTime()
Returns the time this Message was generated.
|
String |
getType()
Returns the type of this Message.
|
int |
hashCode()
Computes a hash code for this message.
|
boolean |
isValid()
Returns the validity flag of this message event.
|
boolean |
parseFromSingleString(String all)
A convenience method to parse all command lines from a single string.
|
abstract boolean |
parseLine(String[] cl)
Parses the message event parameters.
|
static MessageBin |
readFromBufferedStream(BufferedReader in)
Reads a message event from a stream as a sequence of ascii-lines.
|
protected void |
setNr(int nr)
Sets the number of command lines in this message event.
|
void |
setTime(long ti)
Sets the time this Message was generated.
|
protected void |
setType(String ty)
Sets the type of this Message.
|
void |
setValid(boolean val)
Sets the value of the validity flag.
|
String |
toSkippedString(int maxlines)
Converts this message to a single String.
|
String |
toString()
Converts this message to a single String.
|
getHost, getSourceName, setSourceNamegetSourcepublic static final char SEPCHAR
private String type
private long time
private int lineNr
private boolean valid
protected MessageEvent(Object src)
protected MessageEvent(Object src, String type)
public static MessageBin readFromBufferedStream(BufferedReader in) throws IOException
This method reconstructs the message event correctly by reading the required number of command lines from the stream. Nevertheless, follow these guidlines.
in - The buffered reader to read this message from.IOExceptionMessageBinpublic static MessageEvent fromAscii(MessageBin ascii)
MessageBin into a fully functional java object. This
is necessary if you read an ASCII-version of a message event from a
stream. This ascii-version can only represent a message bin. After the
bin has fully been read, this method tries to instantiate the correct
command, as dervied from the type of the message.protected boolean checkType(String type)
type - The message type under question.public String getType()
protected void setType(String ty)
public long getTime()
public void setTime(long ti)
public int getNr()
protected void setNr(int nr)
public boolean isValid()
public void setValid(boolean val)
parseLine(java.lang.String[]).public String getAllCommandLines()
public abstract String[] getLine()
public boolean parseFromSingleString(String all)
public abstract boolean parseLine(String[] cl)
public String toString()
SEPCHAR.
public String toSkippedString(int maxlines)
SEPCHAR.
public String getHead()
public Object getExecuteGroupKey()
public int hashCode()
public boolean equals(Object that)
equals in class Objectthat - The Object to compare to.equalTime(long)public boolean equalTime(MessageEvent that)
public boolean equalTime(long ti)