instances.add(newInstance);
return;
}
Input curInput = inputs().get(depth);
// if curInput is already in the universe this means it was coupled with previous inputs.
// first coupled input will immediately assign other related/coupled inputs.
if(universe.containsKey(curInput)){
instantiateInputRec(universe, depth+1);
}
else
if(curInput instanceof RawInput){
Map<Input, InstanceInput> nextUniverse = new LinkedHashMap<Input, InstanceInput>(universe);
Object nextValue = ((RawInput) curInput).value();
nextUniverse.put(curInput, new InstanceInput(this, curInput, nextValue));
instantiateInputRec(nextUniverse, depth+1);
} else
if(curInput instanceof ReferenceInput){
handleReferenceInput(universe, depth, curInput, curInput);
} else
if(curInput instanceof MultiInput){
List<? extends Input> curMultiInputs = ((MultiInput) curInput).inputs();
for(int i =0;i < curMultiInputs.size();i++){
Input curMultiInput = curMultiInputs.get(i);
if(curMultiInput instanceof RawInput){
handleMultiRawInput(universe, depth, (RawInput) curMultiInput, curInput, i);