gridsim.filter
Class FilterResult
Object
Sim_predicate
FilterResult
public class FilterResult
- extends Sim_predicate
Look for a specific incoming event that matches a given event tag name and a
transaction id. Incoming events with a matching tag name must
contain a data object of type
int[], where int[0] stores the transaction id.
This class is used by Sim_system
to select or filter an event already present in the entity's deferred queue
(incoming buffer), or used to selectively wait for a future event.
An example on how to use this class:
Imagine we have a scenario where Entity_A sends one or more events
to Entity_B with different tag names and data objects.
Entity_B wants to get an event with a HIGH_PRIORITY tag
and a transaction id of 10 in this example.
Therefore, inside the Entity_B code:
... // other code
int transactionID = 10;
int tag = HIGH_PRIORITY;
Sim_event ev = new Sim_event();
FilterResult filter = new FilterResult(transactionID, tag);
// get an incoming event that matches a given transaction ID and
a tag name
super.sim_get_next(filter, ev);
// get the matching event data
int[] data = (int[]) ev.get_data();
// data[0] contains transaction ID
NOTE:
- both Entity_A and Entity_B must be an instance of
Sim_entity
class.
- Entity_A must send the correct data object to
Entity_B for events with a matching tag name.
The event data object with a matching tag name
must be of type int[], where
int[0] contains the transaction id.
- if no incoming events match the given condition, then
Sim_entity.sim_get_next(Sim_predicate, Sim_event)
method will wait indefinitely.
- Since:
- GridSim Toolkit 3.2
- Author:
- Anthony Sulistio
- Invariant:
- $none
Constructor Summary |
FilterResult(int transactionID,
int tag)
Finds an incoming events that matches with the given transaction ID and
event tag name |
Method Summary |
boolean |
match(Sim_event ev)
Checks whether an event matches the required constraints or not.
NOTE: This method is not used directly by the user. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilterResult
public FilterResult(int transactionID,
int tag)
- Finds an incoming events that matches with the given transaction ID and
event tag name
- Parameters:
transactionID
- a unique transaction ID to differentiate
itself among other events with the same tag nametag
- a matching event tag name- Pre Condition:
- $none
- Post Condition:
- $none
match
public boolean match(Sim_event ev)
- Checks whether an event matches the required constraints or not.
NOTE: This method is not used directly by the user. Instead, it is
called by Sim_system
.
- Specified by:
match
in class Sim_predicate
- Parameters:
ev
- an incoming event to compare with
- Returns:
- true if an event matches, false otherwise
- Pre Condition:
- ev != null
- Post Condition:
- $none
The University of Melbourne, Australia, 2009