/** * Tell if two modes match according to the rules of XSLT. * * @param m1 First mode to match * @param m2 Second mode to match * * @return True if the two given modes match */ private boolean matchModes(QName m1, QName m2) { return (((null == m1) && (null == m2)) || ((null != m1) && (null != m2) && m1.equals(m2))); }
/** * Tell if two modes match according to the rules of XSLT. * * @param m1 First mode to match * @param m2 Second mode to match * * @return True if the two given modes match */ private boolean matchModes(QName m1, QName m2) { return (((null == m1) && (null == m2)) || ((null != m1) && (null != m2) && m1.equals(m2))); }
/** * Equality function specialized for the variable name. If the argument * is not a qname, it will deligate to the super class. * * @param obj the reference object with which to compare. * @return <code>true</code> if this object is the same as the obj * argument; <code>false</code> otherwise. */ public boolean equals(Object obj) { if(obj instanceof QName) { return m_qname.equals(obj); } else return super.equals(obj); }
/** * Equality function specialized for the variable name. If the argument * is not a qname, it will deligate to the super class. * * @param obj the reference object with which to compare. * @return <code>true</code> if this object is the same as the obj * argument; <code>false</code> otherwise. */ public boolean equals(Object obj) { if(obj instanceof QName) { return m_qname.equals(obj); } else return super.equals(obj); }
/** * Get an "xsl:variable" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname Qualified name of variable or param * * @return The ElemVariable with the given qualified name */ public ElemVariable getVariableOrParamComposed(QName qname) { if (null != m_variables) { int n = m_variables.size(); for (int i = 0; i < n; i++) { ElemVariable var = (ElemVariable)m_variables.elementAt(i); if(var.getName().equals(qname)) return var; } } return null; }
/** * Get an "xsl:variable" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname Qualified name of variable or param * * @return The ElemVariable with the given qualified name */ public ElemVariable getVariableOrParamComposed(QName qname) { if (null != m_variables) { int n = m_variables.size(); for (int i = 0; i < n; i++) { ElemVariable var = (ElemVariable)m_variables.elementAt(i); if(var.getName().equals(qname)) return var; } } return null; }
/** * @return key declarations for the key associated to this KeyTable */ private Vector getKeyDeclarations() { int nDeclarations = m_keyDeclarations.size(); Vector keyDecls = new Vector(nDeclarations); // Walk through each of the declarations made with xsl:key for (int i = 0; i < nDeclarations; i++) { KeyDeclaration kd = (KeyDeclaration) m_keyDeclarations.elementAt(i); // Add the declaration if the name on this key declaration // matches the name on the iterator for this walker. if (kd.getName().equals(getKeyTableName())) { keyDecls.add(kd); } } return keyDecls; }
/** * @return key declarations for the key associated to this KeyTable */ private Vector getKeyDeclarations() { int nDeclarations = m_keyDeclarations.size(); Vector keyDecls = new Vector(nDeclarations); // Walk through each of the declarations made with xsl:key for (int i = 0; i < nDeclarations; i++) { KeyDeclaration kd = (KeyDeclaration) m_keyDeclarations.elementAt(i); // Add the declaration if the name on this key declaration // matches the name on the iterator for this walker. if (kd.getName().equals(getKeyTableName())) { keyDecls.add(kd); } } return keyDecls; }
/** * NEEDSDOC Method replaceOrPushUserParam * * * NEEDSDOC @param qname * NEEDSDOC @param xval */ private void replaceOrPushUserParam(QName qname, XObject xval) { int n = m_userParams.size(); for (int i = n - 1; i >= 0; i--) { Arg arg = (Arg) m_userParams.elementAt(i); if (arg.getQName().equals(qname)) { m_userParams.setElementAt(new Arg(qname, xval, true), i); return; } } m_userParams.addElement(new Arg(qname, xval, true)); }
/** * NEEDSDOC Method replaceOrPushUserParam * * * NEEDSDOC @param qname * NEEDSDOC @param xval */ private void replaceOrPushUserParam(QName qname, XObject xval) { int n = m_userParams.size(); for (int i = n - 1; i >= 0; i--) { Arg arg = (Arg) m_userParams.elementAt(i); if (arg.getQName().equals(qname)) { m_userParams.setElementAt(new Arg(qname, xval, true), i); return; } } m_userParams.addElement(new Arg(qname, xval, true)); }
/** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; if(!m_qname.equals(((Variable)expr).m_qname)) return false; // We have to make sure that the qname really references // the same variable element. if(getElemVariable() != ((Variable)expr).getElemVariable()) return false; return true; }
/** * @see Expression#deepEquals(Expression) */ public boolean deepEquals(Expression expr) { if(!isSameClass(expr)) return false; if(!m_qname.equals(((Variable)expr).m_qname)) return false; // We have to make sure that the qname really references // the same variable element. if(getElemVariable() != ((Variable)expr).getElemVariable()) return false; return true; }
/** * Get an "xsl:variable" or "xsl:param" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname non-null reference to the qualified name of the variable. * * @return The ElemVariable with the given name in the list or null */ public ElemVariable getVariableOrParam(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = (ElemVariable) getVariableOrParam(i); if (var.getName().equals(qname)) return var; } } return null; }
/** * Get an "xsl:decimal-format" property. * * @see DecimalFormatProperties * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a> * * @param name The qualified name of the decimal format property. * @return null if not found, otherwise a DecimalFormatProperties * object, from which you can get a DecimalFormatSymbols object. */ public DecimalFormatProperties getDecimalFormat(QName name) { if (null == m_DecimalFormatDeclarations) return null; int n = getDecimalFormatCount(); for (int i = (n - 1); i >= 0; i++) { DecimalFormatProperties dfp = getDecimalFormat(i); if (dfp.getName().equals(name)) return dfp; } return null; }
/** * Get an "xsl:variable" or "xsl:param" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname non-null reference to the qualified name of the variable. * * @return The ElemVariable with the given name in the list or null */ public ElemVariable getVariableOrParam(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = (ElemVariable) getVariableOrParam(i); if (var.getName().equals(qname)) return var; } } return null; }
/** * Get an "xsl:decimal-format" property. * * @see DecimalFormatProperties * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a> * * @param name The qualified name of the decimal format property. * @return null if not found, otherwise a DecimalFormatProperties * object, from which you can get a DecimalFormatSymbols object. */ public DecimalFormatProperties getDecimalFormat(QName name) { if (null == m_DecimalFormatDeclarations) return null; int n = getDecimalFormatCount(); for (int i = (n - 1); i >= 0; i++) { DecimalFormatProperties dfp = getDecimalFormat(i); if (dfp.getName().equals(name)) return dfp; } return null; }
/** * Get an "xsl:variable" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname Qualified name of the xsl:variable to get * * @return reference to the variable named by qname, or null if not found. */ public ElemVariable getVariable(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = getVariableOrParam(i); if((var.getXSLToken() == Constants.ELEMNAME_VARIABLE) && (var.getName().equals(qname))) return var; } } return null; }
/** * Get an "xsl:param" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname non-null reference to qualified name of the parameter. * * @return ElemParam with the given name in the list or null */ public ElemParam getParam(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = getVariableOrParam(i); if((var.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE) && (var.getName().equals(qname))) return (ElemParam)var; } } return null; }
/** * Get an "xsl:param" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname non-null reference to qualified name of the parameter. * * @return ElemParam with the given name in the list or null */ public ElemParam getParam(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = getVariableOrParam(i); if((var.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE) && (var.getName().equals(qname))) return (ElemParam)var; } } return null; }
/** * Get an "xsl:variable" property. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a> * * @param qname Qualified name of the xsl:variable to get * * @return reference to the variable named by qname, or null if not found. */ public ElemVariable getVariable(QName qname) { if (null != m_topLevelVariables) { int n = getVariableOrParamCount(); for (int i = 0; i < n; i++) { ElemVariable var = getVariableOrParam(i); if((var.getXSLToken() == Constants.ELEMNAME_VARIABLE) && (var.getName().equals(qname))) return var; } } return null; }