You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@apache.org on 2001/01/23 21:05:27 UTC

cvs commit: xml-xalan/java/compat_src/org/apache/xalan/xpath XBoolean.java XBooleanStatic.java XNodeSet.java XNull.java XNumber.java XRTreeFrag.java XString.java

mmidy       01/01/23 12:05:25

  Modified:    java/compat_src/org/apache/xalan/xpath XBoolean.java
                        XBooleanStatic.java XNodeSet.java XNull.java
                        XNumber.java XRTreeFrag.java XString.java
  Log:
  Derive all classes from XObject
  
  Revision  Changes    Path
  1.2       +62 -2     xml-xalan/java/compat_src/org/apache/xalan/xpath/XBoolean.java
  
  Index: XBoolean.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XBoolean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XBoolean.java	2001/01/11 22:48:09	1.1
  +++ XBoolean.java	2001/01/23 20:04:57	1.2
  @@ -63,16 +63,76 @@
    * This class represents an XPath boolean object, and is capable of 
    * converting the boolean to other types, such as a string.
    */
  -public class XBoolean extends org.apache.xpath.objects.XBoolean
  +public class XBoolean extends XObject
   {
  +  org.apache.xpath.objects.XBoolean m_xboolean;
     
     /**
      * Construct a XBoolean object.
      */
     public XBoolean(boolean b)
     {
  -    super(b);    
  +    super(); 
  +     m_xboolean = new org.apache.xpath.objects.XBoolean(b);
     }
  +  
  +  /**
  +   * Tell that this is a CLASS_BOOLEAN.
  +   */
  +  public int getType()
  +  {
  +    return m_xboolean.getType();
  +  }
  +  
  +  /**
  +   * Given a request type, return the equivalent string. 
  +   * For diagnostic purposes.
  +   */
  +  public String getTypeString() // PR:DMAN4MBJ4D Submitted by:<ga...@firstech.com> change to protected
  +  {
  +    return m_xboolean.getTypeString();
  +  }
  +  
  +  /**
  +   * Cast result object to a number.
  +   */
  +  public double num()
  +  {
  +    return m_xboolean.num();
  +  }
  +
  +  /**
  +   * Cast result object to a boolean.
  +   */
  +  public boolean bool()
  +  {
  +    return m_xboolean.bool();
  +  }
  +
  +  /**
  +   * Cast result object to a string.
  +   */
  +  public String str()
  +  {
  +    return m_xboolean.str();
  +  }
  +  
  +  /**
  +   * Return a java object that's closes to the represenation 
  +   * that should be handed to an extension.
  +   */
  +  public Object object()
  +  {
  +    return m_xboolean.object();
  +  }
  +
  +  /**
  +   * Tell if two objects are functionally equal.
  +   */
  +  public boolean equals(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {    
  +    return m_xboolean.equals(obj2);
  }
     
     
   }
  
  
  
  1.2       +12 -3     xml-xalan/java/compat_src/org/apache/xalan/xpath/XBooleanStatic.java
  
  Index: XBooleanStatic.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XBooleanStatic.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XBooleanStatic.java	2001/01/11 22:48:09	1.1
  +++ XBooleanStatic.java	2001/01/23 20:05:00	1.2
  @@ -63,18 +63,27 @@
    * This class doesn't have any XPathSupport, so override 
    * whatever to ensure it works OK.
    */
  -public class XBooleanStatic extends org.apache.xpath.objects.XBooleanStatic
  +public class XBooleanStatic extends XBoolean
   {
  +  org.apache.xpath.objects.XBooleanStatic m_xboolean;
     
  -  
     /**
      * Construct a XNodeSet object.
      */
     public XBooleanStatic(boolean b)
     {
  -    super(b);    
  +    super(b); 
  +    m_xboolean = new org.apache.xpath.objects.XBooleanStatic(b);
     } 
     
  +  /**
  +   * Tell if two objects are functionally equal.
  +   */
  +  public boolean equals(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xboolean.equals(obj2);
  +  }
   
   }
   
  
  
  
  1.2       +160 -4    xml-xalan/java/compat_src/org/apache/xalan/xpath/XNodeSet.java
  
  Index: XNodeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XNodeSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XNodeSet.java	2001/01/11 22:48:09	1.1
  +++ XNodeSet.java	2001/01/23 20:05:02	1.2
  @@ -61,19 +61,25 @@
   import org.w3c.dom.traversal.NodeFilter;
   import java.text.*;
   
  +import org.apache.xpath.XPathContext;
  +import org.apache.xpath.NodeSet;
  +
   /**
    * <meta name="usage" content="general"/>
    * This class represents an XPath nodeset object, and is capable of 
    * converting the nodeset to other types, such as a string.
    */
  -public class XNodeSet extends org.apache.xpath.objects.XNodeSet
  -{  
  +public class XNodeSet extends XObject  
  +{
  +  org.apache.xpath.objects.XNodeSet m_xnodeset;
  +  
     /**
      * Construct a XNodeSet object.
      */
     public XNodeSet(NodeList val)
     {
  -    super(new NodeIteratorWrapper(val));
  +    super();
  +    m_xnodeset = new org.apache.xpath.objects.XNodeSet(new NodeIteratorWrapper(val)) ;
     }
     
     /**
  @@ -82,16 +88,166 @@
     public XNodeSet()
     {
       super();
  +    m_xnodeset = new org.apache.xpath.objects.XNodeSet();
     }
   
     /**
      * Construct a XNodeSet object for one node.
      */
     public XNodeSet(Node n)
  +  {
  +    super(n); 
  +    m_xnodeset = new org.apache.xpath.objects.XNodeSet(n);
  +  }
  +  
  +  
  +  /**
  +   * Tell that this is a CLASS_NODESET.
  +   */
  +  public int getType()
  +  {
  +    return m_xnodeset.getType();
  +  }
  +  
  +  /**
  +   * Given a request type, return the equivalent string. 
  +   * For diagnostic purposes.
  +   */
  +  public String getTypeString() // PR:DMAN4MBJ4D Submitted by:<ga...@firstech.com> change to protected
  +  {
  +    return m_xnodeset.getTypeString();
  +  }
  +  
  +  /**
  +   * Get the string conversion from a single node.
  +   */
  +  double getNumberFromNode(Node n)
  +  {
  +    return m_xnodeset.getNumberFromNode(n);
  +  }
  +
  +  /**
  +   * Cast result object to a number.
  +   */
  +  public double num()
     {
  -    super(n);    
  +    return m_xnodeset.num();
     }
  +
  +  /**
  +   * Cast result object to a boolean.
  +   */
  +  public boolean bool()
  +  {
  +    return m_xnodeset.bool();
  +  }
     
  +
  +  /**
  +   * Get the string conversion from a single node.
  +   */
  +  static String getStringFromNode(Node n)
  +  {
  +    return org.apache.xpath.objects.XNodeSet.getStringFromNode(n);
  +  }
  +
  +  /**
  +   * Cast result object to a string.
  +   */
  +  public String str()
  +  {
  +    return m_xnodeset.str();
  +  }
  +  
  +  /**
  +   * Cast result object to a result tree fragment.
  +   */
  +  public DocumentFragment rtree(XPathSupport support)
  +  {    
  +    return m_xnodeset.rtree((XPathContext) support);
  +  }
  +  
  +  /**
  +   * Cast result object to a result tree fragment.
  +   *
  +   * @param support The XPath context to use for the conversion 
  +   *
  +   * @return the nodeset as a result tree fragment.
  +   */
  +  public DocumentFragment rtree(XPathContext support)
  +  {
  +    return m_xnodeset.rtree(support);
  +  }
  +
  +  /**
  +   * Cast result object to a nodelist.
  +   */
  +  public NodeIterator nodeset()
  +  {
  +    return m_xnodeset.nodeset();
  +  }  
  +
  +  /**
  +   * Cast result object to a nodelist.
  +   */
  +  public NodeSet mutableNodeset()
  +  {
  +   return m_xnodeset.mutableNodeset();
  +  }  
  +  
  +  /**
  +   * Tell if one object is less than the other.
  +   */
  +  public boolean lessThan(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xnodeset.lessThan(obj2);
  +  }
  +  
  +  /**
  +   * Tell if one object is less than or equal to the other.
  +   */
  +  public boolean lessThanOrEqual(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xnodeset.lessThanOrEqual(obj2);
  +  }
  +  
  +  /**
  +   * Tell if one object is greater than the other.
  +   */
  +  public boolean greaterThan(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xnodeset.greaterThan(obj2);
  +  }
  +  
  +  /**
  +   * Tell if one object is greater than the other.
  +   */
  +  public boolean greaterThanOrEqual(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xnodeset.greaterThanOrEqual(obj2);
  +  }   
  +  
  +  /**
  +   * Tell if two objects are functionally equal.
  +   */
  +  public boolean equals(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xnodeset.equals(obj2);
  +  }  
  +  
  +  /**
  +   * Tell if two objects are functionally not equal.
  +   */
  +  public boolean notEquals(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xnodeset.notEquals(obj2);
  +  }  
    
    static class NodeIteratorWrapper implements NodeIterator
     {
  
  
  
  1.2       +81 -1     xml-xalan/java/compat_src/org/apache/xalan/xpath/XNull.java
  
  Index: XNull.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XNull.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XNull.java	2001/01/11 22:48:09	1.1
  +++ XNull.java	2001/01/23 20:05:04	1.2
  @@ -57,21 +57,101 @@
   package org.apache.xalan.xpath;
   
   import org.w3c.dom.*;
  +import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xpath.XPathContext;
  +
   /**
    * <meta name="usage" content="general"/>
    * This class represents an XPath null object, and is capable of 
    * converting the null to other types, such as a string.
    */
  -public class XNull extends org.apache.xpath.objects.XNull
  +public class XNull extends XObject
   {
  +  org.apache.xpath.objects.XNull m_xnull;
     /**
      * Create an XObject.
      */
     public XNull()
     {
       super();
  +    m_xnull = new org.apache.xpath.objects.XNull() ;
  +  }
  +  
  +  /**
  +   * Tell what kind of class this is.
  +   */
  +  public int getType()
  +  {
  +    return m_xnull.getType();
  +  }
  +
  +  /**
  +   * Given a request type, return the equivalent string. 
  +   * For diagnostic purposes.
  +   */
  +  public String getTypeString() // PR:DMAN4MBJ4D Submitted by:<ga...@firstech.com> change to protected
  +  {
  +    return m_xnull.getTypeString();
  +  }
  
  /**
  +   * Cast result object to a number.
  +   */
  +  public double num()
  +  {
  +    return m_xnull.num();
  +  }
  +
  +  /**
  +   * Cast result object to a boolean.
  +   */
  +  public boolean bool()
  +  {
  +    return m_xnull.bool();
  +  }
  +
  +  /**
  +   * Cast result object to a string.
  +   */
  +  public String str()
  +  {
  +    return m_xnull.str();
  +  }
  +  
  +  /**
  +   * Cast result object to a result tree fragment.
  +   */
  +  public DocumentFragment rtree(XPathSupport support)
  +  {
  +    return m_xnull.rtree((XPathContext)support);
     }
  +  
  +  /**
  +   * Cast result object to a result tree fragment.
  +   *
  +   * @param support XPath context to use for the conversion
  +   *
  +   * @return The object as a result tree fragment.
  +   */
  +  public DocumentFragment rtree(XPathContext support)
  +  {
  +    return m_xnull.rtree(support);
  +  }
  +
  +
  +  /**
  +   * Cast result object to a nodelist.
  +   */
  +  public NodeIterator nodeset()
  +  {
  +    return null;
  +  }  
  +   
  +  /**
  +   * Tell if two objects are functionally equal.
  +   */
  +  public boolean equals(XObject obj2)
  +  {
  +    return m_xnull.equals(obj2);
  }
   
     
   }
  
  
  
  1.2       +64 -4     xml-xalan/java/compat_src/org/apache/xalan/xpath/XNumber.java
  
  Index: XNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XNumber.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XNumber.java	2001/01/11 22:48:09	1.1
  +++ XNumber.java	2001/01/23 20:05:06	1.2
  @@ -64,16 +64,76 @@
    * This class represents an XPath number, and is capable of 
    * converting the number to other types, such as a string.
    */
  -public class XNumber extends org.apache.xpath.objects.XNumber
  +public class XNumber extends XObject
   {
  -    
  +  
  +  org.apache.xpath.objects.XNumber m_xnumber;
     /**
      * Construct a XNodeSet object.
      */
     public XNumber(double d)
     {
  -    super(d);
  -   
  +    super();
  +    m_xnumber = new org.apache.xpath.objects.XNumber(d);
  +  }
  +  
  +  /**
  +   * Tell that this is a CLASS_NUMBER.
  +   */
  +  public int getType()
  +  {
  +    return m_xnumber.getType();
  +  }
  +  
  +  /**
  +   * Given a request type, return the equivalent string. 
  +   * For diagnostic purposes.
  +   */
  +  public String getTypeString() // PR:DMAN4MBJ4D Submitted by:<ga...@firstech.com> change to protected
  +  {
  +    return m_xnumber.getTypeString();
  +  }
  +  
  +  /**
  +   * Cast result object to a number.
  +   */
  +  public double num()
  +  {
  +    return m_xnumber.num();
  +  }
  +
  +  /**
  +   * Cast result object to a boolean.
  +   */
  +  public boolean bool()
  +  {
  +    return m_xnumber.bool();
  +  }
  +  
  +  /**
  +   * Cast result object to a string.
  +   */
  +  public String str()
  +  {
  +    return m_xnumber.str();
  +  }
  +  
  +  /**
  +   * Return a java object that's closes to the represenation 
  +   * that should be handed to an extension.
  +   */
  +  public Object object()
  +  {
  +    return m_xnumber.object();;
  +  }
  +
  +  /**
  +   * Tell if two objects are functionally equal.
  +   */
  +  public boolean equals(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xnumber.equals(obj2);
     }
     
     
  
  
  
  1.2       +72 -2     xml-xalan/java/compat_src/org/apache/xalan/xpath/XRTreeFrag.java
  
  Index: XRTreeFrag.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XRTreeFrag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XRTreeFrag.java	2001/01/11 22:48:09	1.1
  +++ XRTreeFrag.java	2001/01/23 20:05:08	1.2
  @@ -63,14 +63,84 @@
    * This class represents an XPath result tree fragment object, and is capable of 
    * converting the RTF to other types, such as a string.
    */
  -public class XRTreeFrag extends org.apache.xpath.objects.XRTreeFrag
  -{  
  +public class XRTreeFrag extends XObject 
  +{ 
  +  
  +  org.apache.xpath.objects.XRTreeFrag m_xrtreefrag;
  +  
     /**
      * Create an XObject.
      */
     public XRTreeFrag(DocumentFragment frag)
     {
       super(frag);
  +    m_xrtreefrag = new org.apache.xpath.objects.XRTreeFrag(frag); 
  +  }
  +  
  +  /**
  +   * Tell what kind of class this is.
  +   */
  +  public int getType()
  +  {
  +    return m_xrtreefrag.getType();
  +  }
  +
  +  /**
  +   * Given a request type, return the equivalent string. 
  +   * For diagnostic purposes.
  +   */
  +  public String getTypeString() // PR:DMAN4MBJ4D Submitted by:<ga...@firstech.com> change to protected
  +  {
  +    return m_xrtreefrag.getTypeString();
  +  }
  +  
  +  /**
  +   * Cast result object to a number.
  +   */
  +  public double num()
  +  {    
  +    return m_xrtreefrag.num();
  +  }
  +
  +  /**
  +   * Cast result object to a boolean.
  +   */
  +  public boolean bool()
  +  {
  +    return m_xrtreefrag.bool();
  +  }
  +
  +  /**
  +   * Cast result object to a string.
  +   */
  +  public String str()
  +  {
  +    return m_xrtreefrag.str();
  +  }
  +  
  +  /**
  +   * Cast result object to a result tree fragment.
  +   */
  +  public DocumentFragment rtree()
  +  {
  +    return m_xrtreefrag.rtree();
  +  }
  +  
  +  /**
  +   * Cast result object to a nodelist. (special function).
  +   */
  +  public NodeList convertToNodeset()
  +  {
  +    return m_xrtreefrag.convertToNodeset();
  +  }  
  +  
  +  /**
  +   * Tell if two objects are functionally equal.
  +   */
  +  public boolean equals(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {   
  +      return m_xrtreefrag.equals(obj2);    
     }
     
     
  
  
  
  1.2       +87 -1     xml-xalan/java/compat_src/org/apache/xalan/xpath/XString.java
  
  Index: XString.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XString.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XString.java	2001/01/11 19:29:03	1.1
  +++ XString.java	2001/01/23 20:05:09	1.2
  @@ -57,19 +57,105 @@
   package org.apache.xalan.xpath;
   
   
  +import org.w3c.dom.*;
  +
  +import org.apache.xpath.XPathContext;
   /**
    * <meta name="usage" content="general"/>
    * This class represents an XPath string object, and is capable of 
    * converting the string to other types, such as a number.
    */
  -public class XString extends org.apache.xpath.objects.XString
  +public class XString extends XObject
   {
  +  
  +  org.apache.xpath.objects.XString m_xstring;
  +  
     /**
      * Construct a XString object.
      */
     public XString(String val)
     {
       super(val);
  +    m_xstring = new org.apache.xpath.objects.XString(val);
  +  }
  +  
  +   /**
  +   * Tell that this is a CLASS_STRING.
  +   */
  +  public int getType()
  +  {
  +    return m_xstring.getType();
  +  }
  +  
  +  /**
  +   * Given a request type, return the equivalent string. 
  +   * For diagnostic purposes.
  +   */
  +  public String getTypeString() // PR:DMAN4MBJ4D Submitted by:<ga...@firstech.com> change to protected
  +  {
  +    return m_xstring.getTypeString();
  +  }
  +  
  +  /**
  +   * Cast a string to a number.
  +   */
  +  public static double castToNum(String s)
  +  {  
  +    return org.apache.xpath.objects.XString.castToNum(s);    
  +  }
  +  
  +  /**
  +   * Cast result object to a number.
  +   */
  +  public double num()
  +  {
  +    return m_xstring.num();
  +  }
  +
  +  /**
  +   * Cast result object to a boolean.
  +   */
  +  public boolean bool()
  +  {
  +    return m_xstring.bool();
  +  }
  +
  +  /**
  +   * Cast result object to a string.
  +   */
  +  public String str()
  +  {
  +    return m_xstring.str();
  +  }
  +  
  +  /**
  +   * Cast result object to a result tree fragment.
  +   */
  +  public DocumentFragment rtree(XPathSupport support)
  +  {    
  +    return m_xstring.rtree((XPathContext)support);
  +  }
  +  
  +  
  +  /**
  +   * Cast result object to a result tree fragment.
  +   *
  +   * @param support Xpath context to use for the conversion 
  +   *
  +   * @return A document fragment with this string as a child node
  +   */
  +  public DocumentFragment rtree(XPathContext support)
  +  {      
  +    return m_xstring.rtree(support);
  +  }
  +  
  +  /**
  +   * Tell if two objects are functionally equal.
  +   */
  +  public boolean equals(XObject obj2)
  +    throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
  +  {
  +    return m_xstring.equals(obj2);
     }