/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XObject.java,v 1.2.4.1 2005/09/14 20:34:45 jeffsuttor Exp $
*/
/**
* This class represents an XPath object, and is capable of
* converting the object to various types, such as a string.
* This class acts as the base class to other XPath type objects,
* such as XString, and provides polymorphic casting capabilities.
* @xsl.usage general
*/
{
/**
* The java object which this object wraps.
* @serial
*/
/**
* Create an XObject.
*/
public XObject(){}
/**
* Create an XObject.
*
* @param obj Can be any object, should be a specific type
* for derived classes, or null.
*/
{
}
}
/**
* For support of literal objects in xpaths.
*
* @param xctxt The XPath execution context.
*
* @return This object.
*
* @throws javax.xml.transform.TransformerException
*/
{
return this;
}
/**
* Specify if it's OK for detach to release the iterator for reuse.
* This function should be called with a value of false for objects that are
* stored in variables.
* Calling this with a value of false on a XNodeSet will cause the nodeset
* to be cached.
*
* @param allowRelease true if it is OK for detach to release this iterator
* for pooling.
*/
/**
* Detaches the <code>DTMIterator</code> from the set which it iterated
* over, releasing any computational resources and placing the iterator
* in the INVALID state. After <code>detach</code> has been invoked,
* calls to <code>nextNode</code> or <code>previousNode</code> will
* raise a runtime exception.
*/
public void detach(){}
/**
* Forces the object to release it's resources. This is more harsh than
* detach().
*/
public void destruct()
{
{
allowDetachToRelease(true);
detach();
}
}
/**
* Reset for fresh reuse.
*/
public void reset()
{
}
/**
* Directly call the
* characters method on the passed ContentHandler for the
* string-value. Multiple calls to the
* ContentHandler's characters methods may well occur for a single call to
* this method.
*
* @param ch A non-null reference to a ContentHandler.
*
* @throws org.xml.sax.SAXException
*/
{
}
/**
* Create the right XObject based on the type of the object passed. This
* function can not make an XObject that exposes DOM Nodes, NodeLists, and
* NodeIterators to the XSLT stylesheet as node-sets.
*
* @param val The java object which this object will wrap.
*
* @return the right XObject based on the type of the object passed.
*/
{
}
/**
* Create the right XObject based on the type of the object passed.
* This function <emph>can</emph> make an XObject that exposes DOM Nodes, NodeLists, and
* NodeIterators to the XSLT stylesheet as node-sets.
*
* @param val The java object which this object will wrap.
* @param xctxt The XPath context.
*
* @return the right XObject based on the type of the object passed.
*/
{
}
/** Constant for NULL object type */
/** Constant for UNKNOWN object type */
/** Constant for BOOLEAN object type */
/** Constant for NUMBER object type */
/** Constant for STRING object type */
/** Constant for NODESET object type */
/** Constant for RESULT TREE FRAGMENT object type */
/** Represents an unresolved variable type as an integer. */
/**
* Tell what kind of class this is.
*
* @return CLASS_UNKNOWN
*/
public int getType()
{
return CLASS_UNKNOWN;
}
/**
* Given a request type, return the equivalent string.
* For diagnostic purposes.
*
* @return type string "#UNKNOWN" + object class name
*/
{
}
/**
* Cast result object to a number. Always issues an error.
*
* @return 0.0
*
* @throws javax.xml.transform.TransformerException
*/
{
return 0.0;
}
/**
* Cast result object to a number, but allow side effects, such as the
* incrementing of an iterator.
*
* @return numeric value of the string conversion from the
* next node in the NodeSetDTM, or NAN if no node was found
*/
{
return num();
}
/**
* Cast result object to a boolean. Always issues an error.
*
* @return false
*
* @throws javax.xml.transform.TransformerException
*/
{
return false;
}
/**
* Cast result object to a boolean, but allow side effects, such as the
* incrementing of an iterator.
*
* @return True if there is a next node in the nodeset
*/
{
return bool();
}
/**
* Cast result object to a string.
*
* @return The string this wraps or the empty string if null
*/
{
}
/**
* Cast result object to a string.
*
* @return The object as a string
*/
{
}
/**
* Return the string representation of the object
*
*
* @return the string representation of the object
*/
{
return str();
}
/**
* Cast result object to a result tree fragment.
*
* @param support XPath context to use for the conversion
*
* @return the objec as a result tree fragment.
*/
{
{
// %OPT%
}
return result;
}
/**
* Cast result object to a result tree fragment.
*
* @param support XPath context to use for the conversion
*
* @return the objec as a result tree fragment.
*/
{
{
// %OPT%
}
else
{
}
return docFrag;
}
/**
* For functions to override.
*
* @return null
*/
{
return null;
}
/**
* For functions to override.
*
* @return null
*/
public int rtf()
{
}
/**
* Return a java object that's closest to the representation
* that should be handed to an extension.
*
* @return The object that this class wraps
*/
{
return m_obj;
}
/**
* Cast result object to a nodelist. Always issues an error.
*
* @return null
*
* @throws javax.xml.transform.TransformerException
*/
{
return null;
}
/**
* Get a fresh copy of the object. For use with variables.
*
* @return This object, unless overridden by subclass.
*/
{
return this;
}
/**
* Cast result object to a nodelist. Always issues an error.
*
* @return null
*
* @throws javax.xml.transform.TransformerException
*/
{
return null;
}
/**
* Cast result object to a nodelist. Always issues an error.
*
* @return null
*
* @throws javax.xml.transform.TransformerException
*/
{
return null;
}
/**
* Cast result object to a nodelist. Always issues an error.
*
* @return The object as a NodeSetDTM.
*
* @throws javax.xml.transform.TransformerException
*/
{
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
*/
{
switch (t)
{
case CLASS_STRING :
break;
case CLASS_NUMBER :
break;
case CLASS_NODESET :
break;
case CLASS_BOOLEAN :
break;
case CLASS_UNKNOWN :
break;
// %TBD% What to do here?
// case CLASS_RTREEFRAG :
// result = rtree(support);
// break;
default :
new Object[]{ getTypeString(),
}
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
*/
{
// 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.
return obj2.greaterThan(this);
}
/**
* 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
*/
{
// 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.
return obj2.greaterThanOrEqual(this);
}
/**
* 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
*/
{
// 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.
}
/**
* 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
*/
{
// 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.
return obj2.lessThanOrEqual(this);
}
/**
* 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
*/
{
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function.
{
}
else
{
}
}
/**
* 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
*/
{
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function.
}
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param msg Error message to issue
*
* @throws javax.xml.transform.TransformerException
*/
{
}
/**
* 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
*/
{
// 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.
*/
{
// no-op
}
/**
* Cast result object to a string.
*
*
* NEEDSDOC @param fsb
* @return The string this wraps or the empty string if null
*/
{
}
/**
* @see com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)
*/
{
assertion(false, "callVisitors should not be called for this object!!!");
}
/**
* @see Expression#deepEquals(Expression)
*/
{
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.
return false;
return true;
}
}