Package jadex.tools.comanalyzer
Class Message
- java.lang.Object
-
- jadex.tools.comanalyzer.ParameterElement
-
- jadex.tools.comanalyzer.Message
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
public class Message extends ParameterElement
The message object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTENT
static java.lang.String
CONVERSATION_ID
static java.lang.String
DATE
static java.lang.String
DURATION
static java.lang.String
ENCODING
static java.lang.String
IN_REPLY_TO
static java.lang.String
LANGUAGE
static java.util.List
MESSAGE_ATTRIBUTES
The allowed message attributes.static java.lang.String
ONTOLOGY
static java.lang.String
PERFORMATIVE
static java.lang.String
PROTOCOL
protected Component
receiver
The receiver of the messagestatic java.lang.String
RECEIVER
static java.lang.String
RECEIVERS
static java.lang.String
REPLY_BY
static java.lang.String
REPLY_TO
static java.lang.String
REPLY_WITH
protected Component
sender
The sender of the messagestatic java.lang.String
SENDER
static java.lang.String
SEQ_NO
protected int
uniqueId
The unique id (sequence nr) saved for quick accessstatic java.lang.String
XID
-
Fields inherited from class jadex.tools.comanalyzer.ParameterElement
CLASS, NAME, parameters, visible
-
-
Constructor Summary
Constructors Constructor Description Message()
For loading from file.Message(java.lang.Object event, int sequence, java.lang.String xid, IComponentIdentifier sender, IComponentIdentifier receiver, java.lang.Object body)
Create a message with given parameters and sequence number.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
applyFilter(MessageFilter[] filter)
Applies a filter on the message and returns if the visibility has changed.int
compareTo(java.lang.Object o)
Messages are compared by their unique_id.boolean
equals(java.lang.Object obj)
Only messages with the same unique id are equal.static java.lang.String[]
getDeclaredParameters()
Get the user defined parameters.edu.uci.ics.jung.graph.util.Pair
getEndpoints()
Helper method for checking the visibility of the message including the state of sender , receiver and dummy agent Returns a pair of Agents if the message should be displayed ornull
if not.java.lang.String
getId()
java.lang.Object
getParameter(java.lang.String name)
Returns a parameter value.java.util.Map
getParameters()
Returns the parameter map.Component
getReceiver()
Component
getSender()
int
getUniqueId()
int
hashCode()
boolean
hasParameter(java.lang.String name)
Checks if a given parameter is contained by the parameter map.boolean
isMulticast()
void
setDuration(long duration)
void
setReceiver(Component agent)
void
setSender(Component agent)
void
setUniqueId(int uniqueId)
Set the unique id.java.lang.String
toString()
-
Methods inherited from class jadex.tools.comanalyzer.ParameterElement
isVisible, setParameter, setParameters, setVisible
-
-
-
-
Field Detail
-
SEQ_NO
public static final java.lang.String SEQ_NO
- See Also:
- Constant Field Values
-
XID
public static final java.lang.String XID
- See Also:
- Constant Field Values
-
DATE
public static final java.lang.String DATE
- See Also:
- Constant Field Values
-
DURATION
public static final java.lang.String DURATION
- See Also:
- Constant Field Values
-
SENDER
public static final java.lang.String SENDER
- See Also:
- Constant Field Values
-
RECEIVER
public static final java.lang.String RECEIVER
- See Also:
- Constant Field Values
-
RECEIVERS
public static final java.lang.String RECEIVERS
- See Also:
- Constant Field Values
-
PERFORMATIVE
public static final java.lang.String PERFORMATIVE
- See Also:
- Constant Field Values
-
CONTENT
public static final java.lang.String CONTENT
- See Also:
- Constant Field Values
-
ONTOLOGY
public static final java.lang.String ONTOLOGY
- See Also:
- Constant Field Values
-
ENCODING
public static final java.lang.String ENCODING
- See Also:
- Constant Field Values
-
IN_REPLY_TO
public static final java.lang.String IN_REPLY_TO
- See Also:
- Constant Field Values
-
LANGUAGE
public static final java.lang.String LANGUAGE
- See Also:
- Constant Field Values
-
PROTOCOL
public static final java.lang.String PROTOCOL
- See Also:
- Constant Field Values
-
REPLY_BY
public static final java.lang.String REPLY_BY
- See Also:
- Constant Field Values
-
REPLY_WITH
public static final java.lang.String REPLY_WITH
- See Also:
- Constant Field Values
-
REPLY_TO
public static final java.lang.String REPLY_TO
- See Also:
- Constant Field Values
-
CONVERSATION_ID
public static final java.lang.String CONVERSATION_ID
- See Also:
- Constant Field Values
-
MESSAGE_ATTRIBUTES
public static final java.util.List MESSAGE_ATTRIBUTES
The allowed message attributes.
-
sender
protected Component sender
The sender of the message
-
receiver
protected Component receiver
The receiver of the message
-
uniqueId
protected int uniqueId
The unique id (sequence nr) saved for quick access
-
-
Constructor Detail
-
Message
public Message()
For loading from file. Create a message with given parameters and sequence number.- Parameters:
arguments
- The parameters of the message.sequence
- The sequence number of the message.
-
Message
public Message(java.lang.Object event, int sequence, java.lang.String xid, IComponentIdentifier sender, IComponentIdentifier receiver, java.lang.Object body)
Create a message with given parameters and sequence number.- Parameters:
arguments
- The parameters of the message.sequence
- The sequence number of the message.
-
-
Method Detail
-
getDeclaredParameters
public static final java.lang.String[] getDeclaredParameters()
Get the user defined parameters. Does not return parameters for internal use.- Returns:
- All defined parameters.
-
getSender
public Component getSender()
- Returns:
- The sender.
-
getReceiver
public Component getReceiver()
- Returns:
- The receiver.
-
getUniqueId
public int getUniqueId()
- Returns:
- The unique id
-
setUniqueId
public void setUniqueId(int uniqueId)
Set the unique id.- Parameters:
uniqueid
- The unique id.
-
isMulticast
public boolean isMulticast()
- Returns:
- True if the message is part of a multicast.
-
getEndpoints
public edu.uci.ics.jung.graph.util.Pair getEndpoints()
Helper method for checking the visibility of the message including the state of sender , receiver and dummy agent Returns a pair of Agents if the message should be displayed ornull
if not.- Returns:
- The pair of Agents (either redirected or not) or
null
if the message shouldnt be displayed
-
applyFilter
protected boolean applyFilter(MessageFilter[] filter)
Applies a filter on the message and returns if the visibility has changed.- Parameters:
filter
- The filter to be applied on the message.- Returns:
- True if the visibility has changed
-
setSender
public void setSender(Component agent)
- Parameters:
agent
- The sender to set.
-
setReceiver
public void setReceiver(Component agent)
- Parameters:
agent
- The receiver to set.
-
setDuration
public void setDuration(long duration)
- Parameters:
duration
- The duration to set.
-
getId
public java.lang.String getId()
- Specified by:
getId
in classParameterElement
- Returns:
- The id of the element.
-
getParameter
public java.lang.Object getParameter(java.lang.String name)
Returns a parameter value.- Overrides:
getParameter
in classParameterElement
- Parameters:
name
- The name of the parameter.- Returns:
- The value.
-
getParameters
public java.util.Map getParameters()
Returns the parameter map.- Overrides:
getParameters
in classParameterElement
- Returns:
- The parameter map.
-
hasParameter
public boolean hasParameter(java.lang.String name)
Checks if a given parameter is contained by the parameter map.- Overrides:
hasParameter
in classParameterElement
- Parameters:
name
- The name of the parameter.- Returns:
true
if the parameter is contained.
-
compareTo
public int compareTo(java.lang.Object o)
Messages are compared by their unique_id. That implies that messsages are sorted by their sequence number.- Specified by:
compareTo
in interfacejava.lang.Comparable
- Overrides:
compareTo
in classParameterElement
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hashcode.
-
equals
public boolean equals(java.lang.Object obj)
Only messages with the same unique id are equal.- Overrides:
equals
in classParameterElement
-
toString
public java.lang.String toString()
- Overrides:
toString
in classParameterElement
- Returns:
- The string representation for the message.
-
-