public int getSameNameSiblingIndex ( ) { int snsIndex = 1 ; if ( this . parent == null ) { return snsIndex ; } // Go through all the children ... for ( AstNode sibling : this . parent . getChildren ( ) ) { if ( sibling == this ) { break ; } if ( sibling . getName ( ) . equals ( this . name ) ) { ++ snsIndex ; } } return snsIndex ; }
Get the current same - name - sibling index .