int numSiblings = getParentScope().getNumberOfChildren();
if(numSiblings==0)
{
// first sibling
newScope = getParentScope().addChild(
new Node(
new Scope(scopeId)
)
);
}
else
{
// remaining siblingß
Node<Scope> siblingScope = getParentScope().getChildren().get(numSiblings - 1);
newScope = siblingScope.addChild(new Node(
new Scope(scopeId)
));
}
}
else
{
// parent chaining
newScope = getParentScope().addChild(
new Node(
new Scope(scopeId)
)
);
}
return newScope;
}
else
{
// scope remains the same
childContainer.setScopeId(
getParentScope().getData().getId()
);
return getParentScope();
}
}
@Override
void applyUnit(InteractionUnit unit) {
int scopeId = getParentScope().getData().getId();
unit.setScopeId(scopeId);
getParentScope().addChild(
new Node(
new Scope(scopeId)
)
);
}
});