int () { final PsiTypeParameterStub stub = getGreenStub(); if (stub != null) { final PsiTypeParameterListStub parentStub = (PsiTypeParameterListStub)stub.getParentStub(); return parentStub.getChildrenStubs().indexOf(stub); } int ret = 0; PsiElement element = getPrevSibling(); while (element != null) { if (element instanceof PsiTypeParameter) { ret++; } element = element.getPrevSibling(); } return ret; }