Different options are available on Children without the possibility to combine them:
Children { <ChildConcept> <ChildName> [= formula]; /* Child with or without formula*/ <ChildConcept> <ChildName> = { <LocalConceptDefinition> }; /* Child locally redefined */ <ChildConcept> <ChildName> = ( <FirstInput> = <Formula1>, <SecondInput> = <Formula2>,…); /* Child with constructor */ List (<ChildConcept>) <ListName>; } Example 1Below is an example of the local redefinition of a Child. Concept CirclePerimeterComputer : BaseConcept { Attributes { Inputs { Length radius; String circleColor { “Green”, “Blue”, “White” }; } Outputs { Length Perimeter = radius * PI * 2; } } } Concept HoleForScrew : BaseConcept { Attributes { Inputs { Circle inputCircle; } Outputs { Length fastComputedPerimeter = circleComputer\Perimeter; } } Children { // Use of a Fast Perimeter Computer CirclePerimeterComputer circleComputer = { { Outputs { Perimeter = radius * 6.28; } } } } } The formula attributed to circleComputer overrides the one originally defined in the CirclePerimeterComputer Concept. This one will be used only when dealing with circleComputer. In this example, you can note the use of a Path in the formula used to compute fastComputedPerimeter. Example 2When writing a Concept, you may need to define how many Children of a type will be aggregated under itself. To deal with a variable child number, it is possible to declare a List Child in which any object can be aggregated. To instantiate KML Objects into a children list, use the newInList function. Concept Staircase: BaseConcept { Object : VPMReference; Attributes { Inputs { Integer numberOfSteps; } } } Children { List(Step) StairSteps; } Rules { Rule { let i = 1 let currentStep(Step) For i while i <= numberOfSteps { currentStep = newInList(“Step”,”Step” + i, this, StairSteps, ... /* inputs */) } } } } Example 3You may want to order the way objects are evaluated. To do so, use the Ordered keyword. Concept MyCar : BaseConcept { […] Children { Ordered { Axle frontAxle; Wheel frontLeftWheel; Wheel frontRightWheel; } Ordered { Axle rearAxle; Wheel rearLeftWheel; Wheel rearRightWheel; } } } |