protected override BaseInstanceState FindChild(
ISystemContext context,
QualifiedName browseName,
bool createOrReplace,
BaseInstanceState replacement)
{
if (QualifiedName.IsNull(browseName))
{
return null;
}
BaseInstanceState instance = null;
switch (browseName.Name)
{
case Boiler.BrowseNames.InputPipe:
{
if (createOrReplace)
{
if (InputPipe == null)
{
if (replacement == null)
{
InputPipe = new BoilerInputPipeState(this);
}
else
{
InputPipe = (BoilerInputPipeState)replacement;
}
}
}
instance = InputPipe;
break;
}
case Boiler.BrowseNames.Drum:
{
if (createOrReplace)
{
if (Drum == null)
{
if (replacement == null)
{
Drum = new BoilerDrumState(this);
}
else
{
Drum = (BoilerDrumState)replacement;
}
}
}
instance = Drum;
break;
}
case Boiler.BrowseNames.OutputPipe:
{
if (createOrReplace)
{
if (OutputPipe == null)
{
if (replacement == null)
{
OutputPipe = new BoilerOutputPipeState(this);
}
else
{
OutputPipe = (BoilerOutputPipeState)replacement;
}
}
}
instance = OutputPipe;
break;
}
case Boiler.BrowseNames.FlowController:
{
if (createOrReplace)
{
if (FlowController == null)
{
if (replacement == null)
{
FlowController = new FlowControllerState(this);
}
else
{
FlowController = (FlowControllerState)replacement;
}
}
}
instance = FlowController;
break;
}
case Boiler.BrowseNames.LevelController:
{
if (createOrReplace)
{
if (LevelController == null)
{
if (replacement == null)
{
LevelController = new LevelControllerState(this);
}
else
{
LevelController = (LevelControllerState)replacement;
}
}
}
instance = LevelController;
break;
}
case Boiler.BrowseNames.CustomController:
{
if (createOrReplace)
{
if (CustomController == null)
{
if (replacement == null)
{
CustomController = new CustomControllerState(this);
}
else
{
CustomController = (CustomControllerState)replacement;
}
}
}
instance = CustomController;
break;
}
case Boiler.BrowseNames.Simulation:
{
if (createOrReplace)
{
if (Simulation == null)
{
if (replacement == null)
{
Simulation = new BoilerStateMachineState(this);
}
else
{
Simulation = (BoilerStateMachineState)replacement;
}
}
}
instance = Simulation;
break;
}
}
if (instance != null)
{
return instance;
}
return base.FindChild(context, browseName, createOrReplace, replacement);
}
#endregion