Package io.guise.framework.model
Class AbstractModelGroup<M extends Model>
java.lang.Object
io.guise.framework.model.AbstractModelGroup<M>
- Type Parameters:
M
- The type of model contained in the group.
- All Implemented Interfaces:
ModelGroup<M>
- Direct Known Subclasses:
ValuePolicyModelGroup
An abstract implementation of a group of similar models for providing such functions as communication or mutual exclusion. This class is thread safe.
- Author:
- Garret Wilson.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a model to the group.protected void
Actual implementation of adding a model to the group.boolean
Determines whether this group contains the given model.void
Removes a model from the group.protected void
removeImpl
(M model) Actual implementation of removing a model from the group.
-
Constructor Details
-
AbstractModelGroup
Model constructor.- Parameters:
models
- Zero or more models with which to initially place in the group.- Throws:
NullPointerException
- if one of the models isnull
.
-
-
Method Details
-
getModelSet
- Returns:
- The set of models.
-
contains
Description copied from interface:ModelGroup
Determines whether this group contains the given model.- Specified by:
contains
in interfaceModelGroup<M extends Model>
- Parameters:
model
- The model being checked for group inclusion.- Returns:
true
if the model is contained in this group, elsefalse
.
-
add
Adds a model to the group. If the model is already included in the group, no action occurs.This version delegates to
addImpl(Model)
.- Specified by:
add
in interfaceModelGroup<M extends Model>
- Parameters:
model
- The model to add to the group.
-
addImpl
Actual implementation of adding a model to the group.- Parameters:
model
- The model to add to the group.- Throws:
NullPointerException
- if the given model isnull
.
-
remove
Removes a model from the group. If the model is not included in this group, no action occurs.This version delegates to
removeImpl(Model)
.- Specified by:
remove
in interfaceModelGroup<M extends Model>
- Parameters:
model
- The model to remove from the group.
-
removeImpl
Actual implementation of removing a model from the group.- Parameters:
model
- The model to remove from the group.- Throws:
NullPointerException
- if the given model isnull
.
-