}
return contextInstanceContainer.getContextInstance(context);
}
private ContextInstanceContainer getContextInstanceContainer(ContextContainer contextContainer) {
ContextInstanceContainer contextInstanceContainer = null;
if (this instanceof ContextInstanceContainer) {
contextInstanceContainer = (ContextInstanceContainer) this;
} else {
contextInstanceContainer = getEnclosingContextInstanceContainer(this);
}
while (contextInstanceContainer != null) {
if (contextInstanceContainer.getContextContainer() == contextContainer) {
return contextInstanceContainer;
}
contextInstanceContainer = getEnclosingContextInstanceContainer(
(NodeInstance) contextInstanceContainer);
}