The S2S is an extensible framework in which new classes can be created when models with objects describing specific behavior are required. Each new class has to be integrated into the modeling front end and with the rest of the model so that objects of other classes can interact with objects created from the new class.
In order to be integrated with the modeling front-end and the simulation object, it has to implement the interface IModelObject. By implementing this interface, the new class will contain a ModelNode that will keep track of its position in the modeling tree and will also allow other objects to navigate through it.
Creating a new class involves the following steps:
- Decide the position of the class in the model tree.
- Identify how a new object of the class will be created
By the user: If the user creates the object, make a folder object (CollectionNode) in which the user will create the object. Automatically within a user-created object: Identify the parent object of that object and add the statement in the constructor (Sub New) of the parent.
E.g. Folders are automatically created within certain objects. E.g. Organization objects are automatically created within the factory Created during the simulation
-
Implement the IModelObject interface to integrate the object to the rest of the model: Create a private ModelNode object and implement a property Node for the ModelNode. The properties of this ModelNode will be used to integrate the object in the tree structure.
<Serializable()> Public Class [ClassName]
Implements IModelObject Dim myNodeObject As New ModelNode() Property Node() As ModelNode Implements IModelObject.Node Get Node = myNodeObject End Get Set(ByVal Value As ModelNode) myNodeObject = Value End Set End Property Sub Add(ByVal NewID As String) Implements IModelObject.Add End Sub Public Sub New(ByVal NewID As String, ByVal ParentNode As _ ModelNode) ' Link the object to the parent node Me.Node.DefaultConstructor(NewID, ParentNode) Me.Node.obj = Me ' Add child nodes here End Sub
End Class