Package repast.simphony.context
Class ContextEvent<T>
java.lang.Object
repast.simphony.context.ContextEvent<T>
Represents a change occuring to a Context. This includes when objects are
added to and removed from a Context (with the
getTarget()
being valid) or when
projections are added and removed (with the getProjection()
being valid).- Author:
- Tom Howe
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic ContextEvent.EventType
Represents an event where an object is added to the context.static ContextEvent.EventType
static ContextEvent.EventType
Represents an event where an object is removed from the context. -
Constructor Summary
ConstructorDescriptionContextEvent
(ContextEvent.EventType type, Context<T> context, Context<? extends T> subContext) Creates a new instance of ContextEvent with a given type, context and sub-Context.ContextEvent
(ContextEvent.EventType type, Context<T> context, Projection<? super T> projection) Creates a new instance of ContextEvent with a given type, context and Projection.ContextEvent
(ContextEvent.EventType type, Context<T> context, T target) Creates a new instance of ContextEvent with a given type, context and target. -
Method Summary
Modifier and TypeMethodDescriptionGet the context to which the event occured.Projection<? super T>
Gets the project that was the target of the event.Gets the subcontext that was the target of the event, assuming this was a subcontext event.Get the target of the event.getType()
Get the type of event this represents.
-
Field Details
-
ADDED
Represents an event where an object is added to the context. -
MOVED
-
REMOVED
Represents an event where an object is removed from the context.
-
-
Constructor Details
-
ContextEvent
Creates a new instance of ContextEvent with a given type, context and target.- Parameters:
type
- The type of event which occured.context
- The context to which the event occured.target
- The object which was the target of the event.
-
ContextEvent
public ContextEvent(ContextEvent.EventType type, Context<T> context, Projection<? super T> projection) Creates a new instance of ContextEvent with a given type, context and Projection.- Parameters:
type
- The type of event which occured.context
- The context to which the event occured.projection
- The projection which was the target of the event.
-
ContextEvent
public ContextEvent(ContextEvent.EventType type, Context<T> context, Context<? extends T> subContext) Creates a new instance of ContextEvent with a given type, context and sub-Context.- Parameters:
type
- The type of event which occured.context
- The context to which the event occured.subContext
- The subcontext which was the target of the event.
-
-
Method Details
-
getType
Get the type of event this represents.- Returns:
- The type of event.
-
getContext
Get the context to which the event occured.- Returns:
- The effected Context.
-
getTarget
Get the target of the event.- Returns:
- The object which was the target of the event.
-
getProjection
Gets the project that was the target of the event.- Returns:
- a projection that was added or removed
-
getSubContext
Gets the subcontext that was the target of the event, assuming this was a subcontext event.- Returns:
- the subcontext that was the target of the event, assuming this was a subcontext event.
-