⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xobject.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
   * @return null   */  public int rtf()  {    return DTM.NULL;  }  /**   * Return a java object that's closest to the representation   * that should be handed to an extension.   *   * @return The object that this class wraps   */  public Object object()  {    return m_obj;  }  /**   * Cast result object to a nodelist. Always issues an error.   *   * @return null   *   * @throws javax.xml.transform.TransformerException   */  public DTMIterator iter() throws javax.xml.transform.TransformerException  {    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a NodeList!");    return null;  }    /**   * Get a fresh copy of the object.  For use with variables.   *   * @return This object, unless overridden by subclass.   */  public XObject getFresh()  {    return this;  }    /**   * Cast result object to a nodelist. Always issues an error.   *   * @return null   *   * @throws javax.xml.transform.TransformerException   */  public NodeIterator nodeset() throws javax.xml.transform.TransformerException  {    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a NodeList!");    return null;  }    /**   * Cast result object to a nodelist. Always issues an error.   *   * @return null   *   * @throws javax.xml.transform.TransformerException   */  public NodeList nodelist() throws javax.xml.transform.TransformerException  {    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a NodeList!");    return null;  }  /**   * Cast result object to a nodelist. Always issues an error.   *   * @return The object as a NodeSetDTM.   *   * @throws javax.xml.transform.TransformerException   */  public NodeSetDTM mutableNodeset()          throws javax.xml.transform.TransformerException  {    error(XPATHErrorResources.ER_CANT_CONVERT_TO_MUTABLENODELIST,          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a NodeSetDTM!");    return (NodeSetDTM) m_obj;  }  /**   * Cast object to type t.   *   * @param t Type of object to cast this to   * @param support XPath context to use for the conversion   *   * @return This object as the given type t   *   * @throws javax.xml.transform.TransformerException   */  public Object castToType(int t, XPathContext support)          throws javax.xml.transform.TransformerException  {    Object result;    switch (t)    {    case CLASS_STRING :      result = str();      break;    case CLASS_NUMBER :      result = new Double(num());      break;    case CLASS_NODESET :      result = iter();      break;    case CLASS_BOOLEAN :      result = new Boolean(bool());      break;    case CLASS_UNKNOWN :      result = m_obj;      break;    // %TBD%  What to do here?    //    case CLASS_RTREEFRAG :    //      result = rtree(support);    //      break;    default :      error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,            new Object[]{ getTypeString(),                          Integer.toString(t) });  //"Can not convert "+getTypeString()+" to a type#"+t);      result = null;    }    return result;  }  /**   * Tell if one object is less than the other.   *   * @param obj2 Object to compare this to   *   * @return True if this object is less than the given object   *   * @throws javax.xml.transform.TransformerException   */  public boolean lessThan(XObject obj2)          throws javax.xml.transform.TransformerException  {    // In order to handle the 'all' semantics of     // nodeset comparisons, we always call the     // nodeset function.  Because the arguments     // are backwards, we call the opposite comparison    // function.    if (obj2.getType() == XObject.CLASS_NODESET)      return obj2.greaterThan(this);    return this.num() < obj2.num();  }  /**   * Tell if one object is less than or equal to the other.   *   * @param obj2 Object to compare this to   *   * @return True if this object is less than or equal to the given object   *   * @throws javax.xml.transform.TransformerException   */  public boolean lessThanOrEqual(XObject obj2)          throws javax.xml.transform.TransformerException  {    // In order to handle the 'all' semantics of     // nodeset comparisons, we always call the     // nodeset function.  Because the arguments     // are backwards, we call the opposite comparison    // function.    if (obj2.getType() == XObject.CLASS_NODESET)      return obj2.greaterThanOrEqual(this);    return this.num() <= obj2.num();  }  /**   * Tell if one object is greater than the other.   *   * @param obj2 Object to compare this to   *   * @return True if this object is greater than the given object   *   * @throws javax.xml.transform.TransformerException   */  public boolean greaterThan(XObject obj2)          throws javax.xml.transform.TransformerException  {    // In order to handle the 'all' semantics of     // nodeset comparisons, we always call the     // nodeset function.  Because the arguments     // are backwards, we call the opposite comparison    // function.    if (obj2.getType() == XObject.CLASS_NODESET)      return obj2.lessThan(this);    return this.num() > obj2.num();  }  /**   * Tell if one object is greater than or equal to the other.   *   * @param obj2 Object to compare this to   *   * @return True if this object is greater than or equal to the given object   *   * @throws javax.xml.transform.TransformerException   */  public boolean greaterThanOrEqual(XObject obj2)          throws javax.xml.transform.TransformerException  {    // In order to handle the 'all' semantics of     // nodeset comparisons, we always call the     // nodeset function.  Because the arguments     // are backwards, we call the opposite comparison    // function.    if (obj2.getType() == XObject.CLASS_NODESET)      return obj2.lessThanOrEqual(this);    return this.num() >= obj2.num();  }  /**   * Tell if two objects are functionally equal.   *   * @param obj2 Object to compare this to   *   * @return True if this object is equal to the given object   *   * @throws javax.xml.transform.TransformerException   */  public boolean equals(XObject obj2)  {    // In order to handle the 'all' semantics of     // nodeset comparisons, we always call the     // nodeset function.    if (obj2.getType() == XObject.CLASS_NODESET)      return obj2.equals(this);    if (null != m_obj)    {      return m_obj.equals(obj2.m_obj);    }    else    {      return obj2.m_obj == null;    }  }  /**   * Tell if two objects are functionally not equal.   *   * @param obj2 Object to compare this to   *   * @return True if this object is not equal to the given object   *   * @throws javax.xml.transform.TransformerException   */  public boolean notEquals(XObject obj2)          throws javax.xml.transform.TransformerException  {    // In order to handle the 'all' semantics of     // nodeset comparisons, we always call the     // nodeset function.    if (obj2.getType() == XObject.CLASS_NODESET)      return obj2.notEquals(this);    return !equals(obj2);  }  /**   * Tell the user of an error, and probably throw an   * exception.   *   * @param msg Error message to issue   *   * @throws javax.xml.transform.TransformerException   */  protected void error(String msg)          throws javax.xml.transform.TransformerException  {    error(msg, null);  }  /**   * Tell the user of an error, and probably throw an   * exception.   *   * @param msg Error message to issue   * @param args Arguments to use in the message   *   * @throws javax.xml.transform.TransformerException   */  protected void error(String msg, Object[] args)          throws javax.xml.transform.TransformerException  {    String fmsg = XSLMessages.createXPATHMessage(msg, args);    // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR,     //                                      m_support.ERROR,    //                                      null,     //                                      null, fmsg, 0, 0);    // if(shouldThrow)    {      throw new XPathException(fmsg, this);    }  }      /**   * XObjects should not normally need to fix up variables.   */  public void fixupVariables(java.util.Vector vars, int globalsSize)  {    // no-op  }  /**   * Cast result object to a string.   *   *   * NEEDSDOC @param fsb   * @return The string this wraps or the empty string if null   */  public void appendToFsb(com.sun.org.apache.xml.internal.utils.FastStringBuffer fsb)  {    fsb.append(str());  }    /**   * @see com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)   */  public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)  {  	assertion(false, "callVisitors should not be called for this object!!!");  }  /**   * @see Expression#deepEquals(Expression)   */  public boolean deepEquals(Expression expr)  {  	if(!isSameClass(expr))  		return false;  		  	// If equals at the expression level calls deepEquals, I think we're   	// still safe from infinite recursion since this object overrides   	// equals.  I hope.  	if(!this.equals((XObject)expr))  		return false;  		  	return true;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -