Interface EventListener<T extends EventInfo>
- Type Parameters:
T- The class of the object containing information to be given to the listener when the expected event happens.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An interface to define Observers (Listeners) that listen to specific changes in
the state of a given observable object (Subject).
This way, the EventListener gets notified when
the observed object has its state changed.
The interface was defined allowing the Subject object to have more than one state to be observable. If the subject directly implements this interface, it will allow only one kind of state change to be observable. If the Subject has multiple state changes to be observed, it can define multiple EventListener attributes to allow multiple events to be observed.
Such Listeners are used for many simulation entities such as Host, Vm and Cloudlet.
Check the documentation of those interfaces above that provides some Listeners.
- Since:
- CloudSim Plus 1.0
- Author:
- Manoel Campos da Silva Filho
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EventListenerAn implementation of Null Object Pattern that makes nothing (it doesn't perform any operation on each existing method). -
Method Summary
-
Field Details
-
NULL
An implementation of Null Object Pattern that makes nothing (it doesn't perform any operation on each existing method). The pattern is used to avoidNullPointerException's and checking everywhere if a listener object is not null to call its methods.
-
-
Method Details
-
update
Gets notified when the observed object (also called subject of observation) has changed. This method has to be called by the observed objects to notify its state change to the listener.- Parameters:
info- the data about the happened event.
-