new
Function used to deal with the instantiation of children in a list.
Signature
new(concept: String, name: String, father: BaseConcept, [ freeArguments: ObjectType, ..]) : UndefinedType
Arguments
| Name | Input / Output | Required? | Type | Comment |
|---|---|---|---|---|
concept | In | Yes | String | Name of the concept to be instantiated. |
name | In | Yes | String | Name of the object to be created. If the object is instantiated below another object, the name of the created object must be the name of the child attribute for which it is created. |
father | In | Yes | BaseConcept | None if root object otherwise, the father. |
freeArguments | In | No | ObjectType | Used to valuate the concept inputs. Arguments must be entered following the order defined on the concept. |
ReturnType
UndefinedType
Example
Concept Adder : BaseConcept
{
Object: VoidType;
Attributes
{
Inputs
{
Integer a;
Integer b;
}
Outputs
{
Integer result = a+b;
}
}
}
Concept AdderOfAdder : BaseConcept
{
Object : VoidType;
Attributes
{
Inputs
{
Integer in1;
Integer in2;
Integer in3;
Integer in4;
}
Outputs
{
Integer outAdder;
}
}
Children
{
Adder firstAdder;
Adder secondAdder;
}
Rules
{
Rule
{
/* First case, finalize is done automatically by "new"
because all inputs are valuated within the free arguments */
firstAdder = new("Adder","firstAdder",this,in1,in2)
secondAdder = new("Adder","secondAdder",this)
/* No input is given within the free arguments */
secondAdder.a = in3
secondAdder.b = in4
secondAdder.Finalize() /* Necessary to compute the result if we
want to access it in this rule */
outAdder = firstAdder.result + secondAdder.result
}
}
} 