protected int oldFindAndEliminateRedundant ( int start , int firstOccuranceIndex , ExpressionOwner firstOccuranceOwner , ElemTemplateElement psuedoVarRecipient , Vector paths ) throws org . w3c . dom . DOMException { QName uniquePseudoVarName = null ; boolean foundFirst = false ; int numPathsFound = 0 ; int n = paths . size ( ) ; Expression expr1 = firstOccuranceOwner . getExpression ( ) ; if ( DEBUG ) assertIsLocPathIterator ( expr1 , firstOccuranceOwner ) ; boolean isGlobal = ( paths == m_absPaths ) ; LocPathIterator lpi = ( LocPathIterator ) expr1 ; for ( int j = start ; j < n ; j ++ ) { ExpressionOwner owner2 = ( ExpressionOwner ) paths . elementAt ( j ) ; if ( null != owner2 ) { Expression expr2 = owner2 . getExpression ( ) ; boolean isEqual = expr2 . deepEquals ( lpi ) ; if ( isEqual ) { LocPathIterator lpi2 = ( LocPathIterator ) expr2 ; if ( ! foundFirst ) { foundFirst = true ; // Insert variable decl into psuedoVarRecipient // We want to insert this into the first legitimate // position for a variable. ElemVariable var = createPseudoVarDecl ( psuedoVarRecipient , lpi , isGlobal ) ; if ( null == var ) return 0 ; uniquePseudoVarName = var . getName ( ) ; changeToVarRef ( uniquePseudoVarName , firstOccuranceOwner , paths , psuedoVarRecipient ) ; // Replace the first occurance with the variable's XPath, so // that further reduction may take place if needed. paths . setElementAt ( var . getSelect ( ) , firstOccuranceIndex ) ; numPathsFound ++ ; } changeToVarRef ( uniquePseudoVarName , owner2 , paths , psuedoVarRecipient ) ; // Null out the occurance, so we don't have to test it again. paths . setElementAt ( null , j ) ; // foundFirst = true; numPathsFound ++ ; } } } // Change all globals in xsl:templates, etc, to global vars no matter what. if ( ( 0 == numPathsFound ) && ( paths == m_absPaths ) ) { ElemVariable var = createPseudoVarDecl ( psuedoVarRecipient , lpi , true ) ; if ( null == var ) return 0 ; uniquePseudoVarName = var . getName ( ) ; changeToVarRef ( uniquePseudoVarName , firstOccuranceOwner , paths , psuedoVarRecipient ) ; paths . setElementAt ( var . getSelect ( ) , firstOccuranceIndex ) ; numPathsFound ++ ; } return numPathsFound ; }
To be removed .