org.inria.ns.reflex.xml.operator
Class AbstractXOperator

java.lang.Object
  extended by org.inria.ns.reflex.xml.operator.AbstractXOperator
All Implemented Interfaces:
XOperator
Direct Known Subclasses:
ArrayOperator, DefaultXOperator, DOMListOperator, DOMMapOperator, DOMOperator, ItemOperator, ListOperator, MapOperator

public abstract class AbstractXOperator
extends Object
implements XOperator

The X-operator of an X-operable object allows to perform XML updates operations and XPath navigation on this object. This implementation is a skeleton implementation of X-operable objects, that should override methods that are supported by theses objects.

Author:
Philippe Poulard

Constructor Summary
AbstractXOperator(XFactory factory)
          Default Constructor.
 
Method Summary
 void append(int referent, Object parent, Object operand)
          Throws an exception if not overriden.
 void append(Object referent, Object operand)
          Throws an exception if not overriden.
 boolean booleanValueOf(Object referent)
          This implementation returns the boolean value of the referent based on its string value.
 void clear(int referent, Object parent)
          Throws an exception if not overriden.
 void clear(Object referent)
          Throws an exception if not overriden.
 void clearAll(int referent, Object parent)
          Throws an exception if not overriden.
 void clearAll(Object referent)
          Throws an exception if not overriden.
 Object clone(int referent, Object parent)
          Throws an exception if not overriden.
 Object clone(Object referent)
          Throws an exception if not overriden.
 Object getAttributeValue(Object referent, QName attribute)
          Returns the attribute value hosted by the given referent object.
 Object getCommentAt(Object referent, int index)
          Return the child comment at the position specified.
 Object getElementAt(Object referent, int index)
          This default implementation return the element at the position specified from the list of children.
 Object getElementById(QName id, Object referent)
          This default implementation return null.
 Iterator getElementsByName(Object referent, QName name)
          Return the children elements that have the given name.
 int getFamilyIndex(Object referent)
          Return the intrinsic position of this item amongs items of the same family ; for an element <f:foo>, the XPath pattern f:*[n] would use this method in order to test its position.
 int getFamilySize(Object referent)
          Return the intrinsic size of the referent's collection of items of the same family ; for an element <f:foo>, the XPath pattern f:*[last()] would use this method in order to test its position.
 int getIndex(Object referent)
          Return the intrinsic position of this item ; for an element <foo>, the XPath pattern node()[n] would use this method in order to test its position.
 Object getNamedElementAt(Object referent, int index, QName qname)
          Return the child element at the position specified with a specific name.
 Object getNamedProcessingInstructionAt(Object referent, int index, QName target)
          Return the child processing instruction at the position specified with a specific target.
 int getNameIndex(Object referent)
          Return the intrinsic position of this item amongs items of the same name ; for an element <foo>, the XPath pattern foo[n] would use this method in order to test its position.
 int getNameSize(Object referent)
          Return the intrinsic size of the referent's collection of items of the same name ; for an element <foo>, the XPath pattern foo[last()] would use this method in order to test its position.
 Map getNamespaces(Object referent)
          Return the namespaces defined explicitely by the referent object.
 Object getNext(Object referent)
          Return the next object.
 Object getNodeAt(Object referent, int index)
          This default implementation return the item at the position specified from the list of children.
 String getNodeKind(Object referent)
          This implementation is based on the isXXX() methods.
 short getNodeType(Object referent)
          Usually, an X-operable object that is not a node behaves like an element.
 Object getParent(Object referent)
          Return the parent of the referent object.
 Object getPrevious(Object referent)
          Return the previous object.
 Object getProcessingInstructionAt(Object referent, int index)
          Return the child processing instruction at the position specified.
 QName getQName(Object referent)
          Return the qualified name of the referent object if any, or null.
 Object getRoot(Object referent)
          This implementation lookup for the root in the hierarchy by invoking successively the parents.
 int getSize(Object referent)
          Return the intrinsic size of an object.
 String getStringAttributeValue(Object referent, QName attribute)
          Returns the string attribute value hosted by the given referent object.
 String getStringName(Object referent)
          Retrieve the string name of the referent object if any, or "".
 Object getTextAt(Object referent, int index)
          Return the child text at the position specified.
 Type getType(Object referent)
          Return the type of the object.
 int getTypeIndex(Object referent)
          Return the intrinsic position of this item amongs items of the same type ; for an element <foo>, the XPath pattern *[n] would use this method in order to test its position.
 int getTypeSize(Object referent)
          Return the intrinsic size of the referent's collection of items of the same type ; for an element <foo>, the XPath pattern *[last()] would use this method in order to test its position.
 Object getValue(Object referent)
          Retrieve the value of the referent object, or null.
 XFactory getXFactory()
          Return the factory that built this X-operator.
 short getXMLType(Object referent)
          Get the XML type of the referent.
 XOperator getXOperator()
          Return the X-operator of this object.
 void insertAfter(int referent, Object parent, Object operand)
          Throws an exception if not overriden.
 void insertAfter(Object referent, Object parent, Object operand)
          Throws an exception if not overriden.
 void insertBefore(int referent, Object parent, Object operand)
          Throws an exception if not overriden.
 void insertBefore(Object referent, Object parent, Object operand)
          Throws an exception if not overriden.
 boolean isAttribute(Object referent)
           
 boolean isComment(Object referent)
           
 boolean isDocument(Object referent)
           
 boolean isElement(Object referent)
           
 boolean isParentNode(Object referent)
          Indicate if the referent is a parent node, that is to say if it can have children.
 boolean isProcessingInstruction(Object referent)
           
 boolean isText(Object referent)
           
 Number numberValueOf(Object referent)
          This implementation returns the number value of the referent based on its string value.
 void remove(int referent, Object parent)
          Throws an exception if not overriden.
 void remove(Object referent, Object parent)
          Throws an exception if not overriden.
 boolean removeAttribute(Object referent, QName attribute)
          Removes an attribute hosted by the given referent object.
 void rename(int referent, Object parent, QName newName)
          Throws an exception if not overriden.
 void rename(Object referent, Object parent, QName newName)
          Throws an exception if not overriden.
 void replace(int referent, Object parent, Object operand)
          Throws an exception if not overriden.
 void replace(Object referent, Object parent, Object operand)
          Throws an exception if not overriden.
 void setAttribute(Object referent, QName attribute, Object value)
          Sets the attribute value hosted by the given referent object.
 String stringValueOf(Object referent)
          This implementation returns the string value of the referent.
 void update(int referent, Object parent, Object value)
          Throws an exception if not overriden.
 void update(Object referent, Object value)
          Throws an exception if not overriden.
 Object valueOf(Object referent)
          This implementation returns the referent object itself.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.inria.ns.reflex.xml.operator.XOperator
getAttributes, getChildren, getTypeName
 

Constructor Detail

AbstractXOperator

public AbstractXOperator(XFactory factory)
Default Constructor.

Method Detail

getXFactory

public XFactory getXFactory()
Return the factory that built this X-operator.

Specified by:
getXFactory in interface XOperator
Returns:
The factory that built this X-operator.

getXOperator

public XOperator getXOperator()
Return the X-operator of this object.

Returns:
The non null X-operator of this object.

getParent

public Object getParent(Object referent)
Return the parent of the referent object. This default implementation returns null.

The parent returned is not the structural parent of the object, but the functional parent ; for example, if a component stores its attributes in a Map, the parent of an attribute of the component is not the Map that hold the attributes but the component itself.

Specified by:
getParent in interface XOperator
Parameters:
referent - The referent object.
Returns:
The parent of the referent object.

getNext

public Object getNext(Object referent)
Return the next object. This default implementation returns null.

Specified by:
getNext in interface XOperator
Parameters:
referent - The referent object.
Returns:
The object after the referent object.

getPrevious

public Object getPrevious(Object referent)
Return the previous object. This default implementation returns null.

Specified by:
getPrevious in interface XOperator
Parameters:
referent - The referent object.
Returns:
The object before the referent object.

getType

public Type getType(Object referent)
Return the type of the object. This default implementation returns null.

Specified by:
getType in interface XOperator
Parameters:
referent - The referent object.
Returns:
The type of the referent object.

getNamespaces

public Map getNamespaces(Object referent)
Return the namespaces defined explicitely by the referent object.

This default implementation build the namespace set from the attributes which name is bound to the XMLNS namespace URI. The QName keeps the form of the original attribute, that is to say xmlns:prefix or xmlns.

If the referent defines xmlns="" (cancelling the default namespace), it will be present in this result map, but must be removed in the in-scope namespaces of the referent.

Specified by:
getNamespaces in interface XOperator
Parameters:
referent - The referent object.
Returns:
A non-null map of {QName, ChildItem}.
See Also:
XMLNames.XMLNS_NAMESPACE_URI, QName, ChildItem, XMaster.getInScopeNamespaces(Object), XMaster.extractNamespaces(Map)

getQName

public QName getQName(Object referent)
Return the qualified name of the referent object if any, or null. This default implementation returns null.

Specified by:
getQName in interface XOperator
Parameters:
referent - The referent object.
Returns:
The qualified name of the referent object.

getStringName

public String getStringName(Object referent)
Retrieve the string name of the referent object if any, or "". This default implementation returns the local name of the qualified name, or "".

Specified by:
getStringName in interface XOperator
Parameters:
referent - The referent object.
Returns:
The string name of the referent object.

getValue

public Object getValue(Object referent)
Retrieve the value of the referent object, or null. This default implementation returns null.

Specified by:
getValue in interface XOperator
Parameters:
referent - The referent object.
Returns:
The value of the referent object.

getNodeType

public short getNodeType(Object referent)
Usually, an X-operable object that is not a node behaves like an element.

Specified by:
getNodeType in interface XOperator
Parameters:
referent - The referent object.
Returns:
This implementation returns the "element type".
See Also:
XType.ELEMENT_NODE

getAttributeValue

public Object getAttributeValue(Object referent,
                                QName attribute)
Returns the attribute value hosted by the given referent object.

Specified by:
getAttributeValue in interface XOperator
Parameters:
referent - The referent object.
attribute - The name of the attribute.
Returns:
The value of the attribute, or null if it does not exists.

getStringAttributeValue

public String getStringAttributeValue(Object referent,
                                      QName attribute)
Returns the string attribute value hosted by the given referent object.

Specified by:
getStringAttributeValue in interface XOperator
Parameters:
referent - The referent object.
attribute - The name of the attribute.
Returns:
The value of the attribute converted to a string, or null if it does not exists.

setAttribute

public void setAttribute(Object referent,
                         QName attribute,
                         Object value)
                  throws UnsupportedOperationException
Sets the attribute value hosted by the given referent object.

Specified by:
setAttribute in interface XOperator
Parameters:
referent - The referent object.
attribute - The name of the attribute.
value - The value of the attribute.
Throws:
UnsupportedOperationException - When the operation is not supported.

removeAttribute

public boolean removeAttribute(Object referent,
                               QName attribute)
Removes an attribute hosted by the given referent object.

Specified by:
removeAttribute in interface XOperator
Parameters:
referent - The referent object.
attribute - The name of the attribute to remove.
Returns:
true if the attribute was really removed, false if it wasn't existed before.

append

public void append(Object referent,
                   Object operand)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : appends an object to the end of the child list of a referent object. An implementation that deals with the append operation must append the operand object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
append in interface XOperator
Parameters:
referent - The referent object to append to.
operand - The object to append.
Throws:
UnsupportedOperationException - When the operation is not supported.

append

public void append(int referent,
                   Object parent,
                   Object operand)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : appends an object to the end of the child list of a referent object. An implementation that deals with the append operation must append the operand object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
append in interface XOperator
Parameters:
referent - The position of the referent object to append to.
parent - The non null parent object of the referent.
operand - The object to append.
Throws:
UnsupportedOperationException - When the operation is not supported.

clear

public void clear(Object referent)
           throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : clear the content of a referent object. An implementation that deals with the clear operation must clear the content of the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
clear in interface XOperator
Parameters:
referent - The referent object to clear.
Throws:
UnsupportedOperationException - When the operation is not supported.

clear

public void clear(int referent,
                  Object parent)
           throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : clear the content of a referent object. An implementation that deals with the clear operation must clear the content of the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
clear in interface XOperator
Parameters:
referent - The position of the referent object to append to.
parent - The non null parent object of the referent.
Throws:
UnsupportedOperationException - When the operation is not supported.

clearAll

public void clearAll(Object referent)
              throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : removes all the childs of a referent object. An implementation that deals with the clear all operation must remove all the childs of the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
clearAll in interface XOperator
Parameters:
referent - The referent object to clear all.
Throws:
UnsupportedOperationException - When the operation is not supported.

clearAll

public void clearAll(int referent,
                     Object parent)
              throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : removes all the childs of a referent object. An implementation that deals with the clear all operation must remove all the childs of the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
clearAll in interface XOperator
Parameters:
referent - The position of the referent object to append to.
parent - The non null parent object of the referent.
Throws:
UnsupportedOperationException - When the operation is not supported.

clone

public Object clone(Object referent)
             throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : clones a referent object to a new one that is a field to field copy of the referent object. An implementation that deals with the clone operation must clone the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
clone in interface XOperator
Parameters:
referent - The referent object to clone.
Throws:
UnsupportedOperationException - When the operation is not supported.

clone

public Object clone(int referent,
                    Object parent)
             throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : clones a referent object to a new one that is a field to field copy of the referent object. An implementation that deals with the clone operation must clone the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
clone in interface XOperator
Parameters:
referent - The position of the referent object to clone.
parent - The non null parent object of the referent.
Throws:
UnsupportedOperationException - When the operation is not supported.

insertAfter

public void insertAfter(Object referent,
                        Object parent,
                        Object operand)
                 throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : inserts an object after the referent object given. An implementation that deals with the insert after operation must insert the operand object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
insertAfter in interface XOperator
Parameters:
referent - The referent object where to insert after.
parent - The parent object of the referent, or null if the referent is able to retrieve it by itself.
operand - The object to insert.
Throws:
UnsupportedOperationException - When the operation is not supported.

insertAfter

public void insertAfter(int referent,
                        Object parent,
                        Object operand)
                 throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : inserts an object after the referent object given. An implementation that deals with the insert after operation must insert the operand object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
insertAfter in interface XOperator
Parameters:
referent - The position of the referent object where to insert after.
parent - The non null parent object of the referent.
operand - The object to insert.
Throws:
UnsupportedOperationException - When the operation is not supported.

insertBefore

public void insertBefore(Object referent,
                         Object parent,
                         Object operand)
                  throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : inserts an object before the referent object given. An implementation that deals with the insert before operation must insert the operand object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
insertBefore in interface XOperator
Parameters:
referent - The referent object where to insert before.
parent - The parent object of the referent, or null if the referent is able to retrieve it by itself.
operand - The object to insert.
Throws:
UnsupportedOperationException - When the operation is not supported.

insertBefore

public void insertBefore(int referent,
                         Object parent,
                         Object operand)
                  throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : inserts an object before the referent object given. An implementation that deals with the insert before operation must insert the operand object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
insertBefore in interface XOperator
Parameters:
referent - The position of the referent object where to insert before.
parent - The non null parent object of the referent.
operand - The object to insert.
Throws:
UnsupportedOperationException - When the operation is not supported.

remove

public void remove(Object referent,
                   Object parent)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : removes a referent object from its parent. An implementation that deals with the remove operation must remove the referent object from its parent. Other implementation MUST throw UnsupportedOperationException.

Specified by:
remove in interface XOperator
Parameters:
referent - The referent object to remove.
parent - The parent object of the referent, or null if the referent is able to retrieve it by itself.
Throws:
UnsupportedOperationException - If not overriden, this operation is not supported.

remove

public void remove(int referent,
                   Object parent)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : removes a referent object from its parent. An implementation that deals with the remove operation must remove the referent object from its parent. Other implementation MUST throw UnsupportedOperationException.

Specified by:
remove in interface XOperator
Parameters:
referent - The position of the referent object to remove.
parent - The non null parent object of the referent.
Throws:
UnsupportedOperationException - If not overriden, this operation is not supported.

rename

public void rename(Object referent,
                   Object parent,
                   QName newName)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : renames a referent object. An implementation that deals with the rename operation must rename the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
rename in interface XOperator
Parameters:
referent - The referent object to rename.
parent - The parent object of the referent, or null if the referent is able to retrieve it by itself or may be renamed without involving its parent.
newName - The new name of the referent object. If the referent object only support String, the QName should be built with an NCName.
Throws:
UnsupportedOperationException - When the operation is not supported.

rename

public void rename(int referent,
                   Object parent,
                   QName newName)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : renames a referent object. An implementation that deals with the rename operation must rename the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
rename in interface XOperator
Parameters:
referent - The position of the referent object to rename.
parent - The non null parent object of the referent.
newName - The new name of the referent object. If the referent object only support String, the QName should be built with an NCName.
Throws:
UnsupportedOperationException - When the operation is not supported.

replace

public void replace(Object referent,
                    Object parent,
                    Object operand)
             throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : replaces a referent object by another object from its parent. An implementation that deals with the replace operation must replace the referent object by the operand. Other implementation MUST throw UnsupportedOperationException.

Specified by:
replace in interface XOperator
Parameters:
referent - The referent object to replace.
parent - The parent object of the referent, or null if the referent is able to retrieve it by itself.
operand - The object that will replace the referent object.
Throws:
UnsupportedOperationException - When the operation is not supported.

replace

public void replace(int referent,
                    Object parent,
                    Object operand)
             throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : replaces a referent object by another object from its parent. An implementation that deals with the replace operation must replace the referent object by the operand. Other implementation MUST throw UnsupportedOperationException.

Specified by:
replace in interface XOperator
Parameters:
referent - The position of the referent object to replace.
parent - The non null parent object of the referent.
operand - The object that will replace the referent object.
Throws:
UnsupportedOperationException - When the operation is not supported.

update

public void update(Object referent,
                   Object value)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : updates a referent object with a value. An implementation that deals with the update operation must update the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
update in interface XOperator
Parameters:
referent - The position of the referent object to update.
value - The new value of the referent.
Throws:
UnsupportedOperationException - When the operation is not supported.

update

public void update(int referent,
                   Object parent,
                   Object value)
            throws UnsupportedOperationException
Throws an exception if not overriden. Otherwise : updates a referent object with a value. An implementation that deals with the update operation must update the referent object. Other implementation MUST throw UnsupportedOperationException.

Specified by:
update in interface XOperator
Parameters:
referent - The referent object to update.
parent - The parent object of the referent, or null if the referent is able to retrieve it by itself or may be renamed without involving its parent.
value - The new value of the referent.
Throws:
UnsupportedOperationException - When the operation is not supported.

getElementById

public Object getElementById(QName id,
                             Object referent)
This default implementation return null.

Specified by:
getElementById in interface XOperator
Parameters:
id - The ID.
referent - The referent.
Returns:
null

getElementsByName

public Iterator getElementsByName(Object referent,
                                  QName name)
Return the children elements that have the given name. This implementation is backed by XOperator.getChildren(Object)

Specified by:
getElementsByName in interface XOperator
Parameters:
referent - The referent.
name - The name.
Returns:
A non-null iterator on the elements that has the name given.

getElementAt

public Object getElementAt(Object referent,
                           int index)
This default implementation return the element at the position specified from the list of children.

Specified by:
getElementAt in interface XOperator
Parameters:
referent - The parent node.
index - The index.
Returns:
The element, or null.
See Also:
XOperator.getChildren(Object), XOperator.isElement(Object)

getNodeAt

public Object getNodeAt(Object referent,
                        int index)
This default implementation return the item at the position specified from the list of children.

Specified by:
getNodeAt in interface XOperator
Parameters:
referent - The parent node.
index - The index.
Returns:
The item, or null.
See Also:
XOperator.getChildren(Object)

getTextAt

public Object getTextAt(Object referent,
                        int index)
Description copied from interface: XOperator
Return the child text at the position specified.

Specified by:
getTextAt in interface XOperator
Parameters:
referent - The parent node.
index - The index.
Returns:
The text, or null.

getCommentAt

public Object getCommentAt(Object referent,
                           int index)
Description copied from interface: XOperator
Return the child comment at the position specified.

Specified by:
getCommentAt in interface XOperator
Parameters:
referent - The parent node.
index - The index.
Returns:
The comment, or null.

getProcessingInstructionAt

public Object getProcessingInstructionAt(Object referent,
                                         int index)
Description copied from interface: XOperator
Return the child processing instruction at the position specified.

Specified by:
getProcessingInstructionAt in interface XOperator
Parameters:
referent - The parent node.
index - The index.
Returns:
The processing instruction, or null.

getNamedElementAt

public Object getNamedElementAt(Object referent,
                                int index,
                                QName qname)
Description copied from interface: XOperator
Return the child element at the position specified with a specific name. The previous index-1 element with the name given are skipped.

Specified by:
getNamedElementAt in interface XOperator
Parameters:
referent - The parent node.
index - The index.
qname - The name of the element to count.
Returns:
The element with the same name, or null.

getNamedProcessingInstructionAt

public Object getNamedProcessingInstructionAt(Object referent,
                                              int index,
                                              QName target)
Description copied from interface: XOperator
Return the child processing instruction at the position specified with a specific target. The previous index-1 PI with the target given are skipped.

Specified by:
getNamedProcessingInstructionAt in interface XOperator
Parameters:
referent - The parent node.
index - The index.
target - The target of the PI to count, as an NCName.
Returns:
The PI with the same target, or null.

isDocument

public boolean isDocument(Object referent)
Specified by:
isDocument in interface XOperator
Parameters:
referent -
Returns:

isElement

public boolean isElement(Object referent)
Specified by:
isElement in interface XOperator
Parameters:
referent -
Returns:

isAttribute

public boolean isAttribute(Object referent)
Specified by:
isAttribute in interface XOperator
Parameters:
referent -
Returns:

isText

public boolean isText(Object referent)
Specified by:
isText in interface XOperator
Parameters:
referent -
Returns:

isComment

public boolean isComment(Object referent)
Specified by:
isComment in interface XOperator
Parameters:
referent -
Returns:

isProcessingInstruction

public boolean isProcessingInstruction(Object referent)
Specified by:
isProcessingInstruction in interface XOperator
Parameters:
referent -
Returns:

getXMLType

public short getXMLType(Object referent)
Get the XML type of the referent.

Specified by:
getXMLType in interface XOperator
See Also:
XType

getNodeKind

public String getNodeKind(Object referent)
This implementation is based on the isXXX() methods.

Specified by:
getNodeKind in interface XOperator
Returns:
"attribute", "comment", "document", "element", "namespace", "processing-instruction", "text" or ""

isParentNode

public boolean isParentNode(Object referent)
Indicate if the referent is a parent node, that is to say if it can have children.

Specified by:
isParentNode in interface XOperator
Parameters:
referent - The referent.
Returns:
This implementation returns true if it is an element or a document, false otherwise.
See Also:
XOperator.isElement(Object), XOperator.isDocument(Object)

stringValueOf

public String stringValueOf(Object referent)
This implementation returns the string value of the referent.

Specified by:
stringValueOf in interface XOperator
Parameters:
referent - The referent.
Returns:
Its string value.
See Also:
Object.toString()

numberValueOf

public Number numberValueOf(Object referent)
This implementation returns the number value of the referent based on its string value. May return an arbitrary-precision signed decimal number.

Specified by:
numberValueOf in interface XOperator
Parameters:
referent - The referent.
Returns:
Its number value.
See Also:
stringValueOf(Object), NumberOperator.parseNumber(String)

booleanValueOf

public boolean booleanValueOf(Object referent)
This implementation returns the boolean value of the referent based on its string value.

Specified by:
booleanValueOf in interface XOperator
Parameters:
referent - The referent.
Returns:
Its boolean value.
See Also:
stringValueOf(Object)

valueOf

public Object valueOf(Object referent)
This implementation returns the referent object itself.

Specified by:
valueOf in interface XOperator
Parameters:
referent - The referent.
Returns:
The referent.

getRoot

public Object getRoot(Object referent)
This implementation lookup for the root in the hierarchy by invoking successively the parents.

Specified by:
getRoot in interface XOperator
Parameters:
referent - An item in the hierarchy.
Returns:
The root, or null if the referent is not in a hierarchy or is unreachable.
See Also:
getParent(Object)

getIndex

public int getIndex(Object referent)
Return the intrinsic position of this item ; for an element <foo>, the XPath pattern node()[n] would use this method in order to test its position.

Specified by:
getIndex in interface XOperator
Parameters:
referent - The referent object.
Returns:
The intrinsic position of this item.
See Also:
#getNaturalSize(Object), getTypeIndex(Object), getFamilyIndex(Object), getNameIndex(Object)

getSize

public int getSize(Object referent)
Return the intrinsic size of an object.

Specified by:
getSize in interface XOperator
Parameters:
referent - The referent object.
Returns:
Its natural size.
See Also:
#getNaturalIndex(Object), getTypeSize(Object), getFamilySize(Object), getNameSize(Object)

getTypeIndex

public int getTypeIndex(Object referent)
Return the intrinsic position of this item amongs items of the same type ; for an element <foo>, the XPath pattern *[n] would use this method in order to test its position.

Specified by:
getTypeIndex in interface XOperator
Parameters:
referent - The referent object.
Returns:
The intrinsic position of this item.

getTypeSize

public int getTypeSize(Object referent)
Description copied from interface: XOperator
Return the intrinsic size of the referent's collection of items of the same type ; for an element <foo>, the XPath pattern *[last()] would use this method in order to test its position.

Specified by:
getTypeSize in interface XOperator
Parameters:
referent -
Returns:

getFamilyIndex

public int getFamilyIndex(Object referent)
Return the intrinsic position of this item amongs items of the same family ; for an element <f:foo>, the XPath pattern f:*[n] would use this method in order to test its position.

Specified by:
getFamilyIndex in interface XOperator
Parameters:
referent - The referent object.
Returns:
The intrinsic position of this item.

getFamilySize

public int getFamilySize(Object referent)
Description copied from interface: XOperator
Return the intrinsic size of the referent's collection of items of the same family ; for an element <f:foo>, the XPath pattern f:*[last()] would use this method in order to test its position.

Specified by:
getFamilySize in interface XOperator
Parameters:
referent -
Returns:

getNameIndex

public int getNameIndex(Object referent)
Return the intrinsic position of this item amongs items of the same name ; for an element <foo>, the XPath pattern foo[n] would use this method in order to test its position.

Specified by:
getNameIndex in interface XOperator
Parameters:
referent - The referent object.
Returns:
The intrinsic position of this item.

getNameSize

public int getNameSize(Object referent)
Description copied from interface: XOperator
Return the intrinsic size of the referent's collection of items of the same name ; for an element <foo>, the XPath pattern foo[last()] would use this method in order to test its position.

Specified by:
getNameSize in interface XOperator
Parameters:
referent -
Returns: