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

java.lang.Object
  extended by org.inria.ns.reflex.xml.operator.AbstractXOperator
      extended by org.inria.ns.reflex.xml.operator.MapOperator
All Implemented Interfaces:
LoopOnChildren, XOperator

public class MapOperator
extends AbstractXOperator
implements XOperator, LoopOnChildren

XML operations on a Map.

Only the static methods of this class are usable directly. To use the methods of the singleton, use the master operator that ensure the type of the arguments.

Author:
Philippe Poulard
See Also:
Map, XMaster

Method Summary
 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.
 Map getAttributes(Object referent)
          Returns the attributes of the given referent object.
 List getChildren(Object referent)
          Returns the children of the given referent object.
 Object getElementById(QName id, Object referent)
          This default implementation return null.
 int getFamilyIndex(Object referent)
          Return the intrinsic position of this item amongs items of the same family, that is to say 0.
 int getFamilySize(Object referent)
          Return the intrinsic size of this item amongs items of the same family, that is to say 0.
 int getIndex(Object referent)
          Return the intrinsic position of an object, that is to say 0.
 int getNameIndex(Object referent)
          Return the intrinsic position of this item amongs items of the same name, that is to say 0.
 int getNameSize(Object referent)
          Return the intrinsic position of this item amongs items of the same name, that is to say 0.
 short getNodeType(Object referent)
          The referent behaves like an element.
 int getSize(Object referent)
          Return the intrinsic size of an object, that is to say 0.
 int getTypeIndex(Object referent)
          Return the intrinsic position of this item amongs items of the same type, that is to say 0.
 QName getTypeName(Object referent)
          Return #adt:map.
 int getTypeSize(Object referent)
          Return the intrinsic size of this item amongs items of the same type, that is to say 0.
 boolean isParentNode(Object referent)
          Indicate if the referent is a parent node, that is to say if it can have children.
 Number numberValueOf(Object referent)
          This implementation returns the number value of the referent based on its string value.
static void register(XMaster xmaster)
          Registers this operator to the master operator.
 String stringValueOf(Object referent)
          This implementation returns the string value of the referent.
 Object valueOf(Object referent)
          Return the first item in the map or null.
 
Methods inherited from class org.inria.ns.reflex.xml.operator.AbstractXOperator
append, clear, clear, clearAll, clearAll, clone, clone, getAttributeValue, getCommentAt, getElementAt, getElementsByName, getNamedElementAt, getNamedProcessingInstructionAt, getNamespaces, getNext, getNodeAt, getNodeKind, getParent, getPrevious, getProcessingInstructionAt, getQName, getRoot, getStringAttributeValue, getStringName, getTextAt, getType, getValue, getXFactory, getXMLType, getXOperator, insertAfter, insertAfter, insertBefore, insertBefore, isAttribute, isComment, isDocument, isElement, isProcessingInstruction, isText, remove, remove, removeAttribute, rename, rename, replace, replace, setAttribute, update, update
 
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
append, clear, clear, clearAll, clearAll, clone, clone, getAttributeValue, getCommentAt, getElementAt, getElementsByName, getNamedElementAt, getNamedProcessingInstructionAt, getNamespaces, getNext, getNodeAt, getNodeKind, getParent, getPrevious, getProcessingInstructionAt, getQName, getRoot, getStringAttributeValue, getStringName, getTextAt, getType, getValue, getXFactory, getXMLType, insertAfter, insertAfter, insertBefore, insertBefore, isAttribute, isComment, isDocument, isElement, isProcessingInstruction, isText, remove, remove, removeAttribute, rename, rename, replace, replace, setAttribute, update, update
 

Method Detail

register

public static void register(XMaster xmaster)
Registers this operator to the master operator.

Parameters:
xmaster - The master operator.

getChildren

public List getChildren(Object referent)
Description copied from interface: XOperator
Returns the children of the given referent object.

Specified by:
getChildren in interface XOperator
Parameters:
referent - The referent object.
Returns:
The childs of the referent object.

isParentNode

public boolean isParentNode(Object referent)
Description copied from class: AbstractXOperator
Indicate if the referent is a parent node, that is to say if it can have children.

Specified by:
isParentNode in interface XOperator
Overrides:
isParentNode in class AbstractXOperator
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)

getAttributes

public Map getAttributes(Object referent)
Description copied from interface: XOperator
Returns the attributes of the given referent object.

Specified by:
getAttributes in interface XOperator
Parameters:
referent - The referent object.
Returns:
The attributes of the referent object.

stringValueOf

public String stringValueOf(Object referent)
Description copied from class: AbstractXOperator
This implementation returns the string value of the referent.

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

numberValueOf

public Number numberValueOf(Object referent)
Description copied from class: AbstractXOperator
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
Overrides:
numberValueOf in class AbstractXOperator
Parameters:
referent - The referent.
Returns:
Its number value.
See Also:
AbstractXOperator.stringValueOf(Object), NumberOperator.parseNumber(String)

booleanValueOf

public boolean booleanValueOf(Object referent)
Description copied from class: AbstractXOperator
This implementation returns the boolean value of the referent based on its string value.

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

valueOf

public Object valueOf(Object referent)
Return the first item in the map or null.

Specified by:
valueOf in interface XOperator
Overrides:
valueOf in class AbstractXOperator
Parameters:
referent - The referent.
Returns:
The first item in the map or null.

getElementById

public Object getElementById(QName id,
                             Object referent)
Description copied from class: AbstractXOperator
This default implementation return null.

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

append

public void append(Object referent,
                   Object operand)
            throws UnsupportedOperationException
Description copied from class: AbstractXOperator
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
Overrides:
append in class AbstractXOperator
Parameters:
referent - The referent object to append to.
operand - The object to append.
Throws:
UnsupportedOperationException - When the operation is not supported.

getNodeType

public short getNodeType(Object referent)
The referent behaves like an element.

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

getTypeName

public QName getTypeName(Object referent)
Return #adt:map.

Specified by:
getTypeName in interface XOperator
Parameters:
referent - A map.
Returns:
adt:map

getIndex

public int getIndex(Object referent)
Return the intrinsic position of an object, that is to say 0.

Specified by:
getIndex in interface XOperator
Overrides:
getIndex in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0.
See Also:
#getNaturalSize(Object), AbstractXOperator.getTypeIndex(Object), AbstractXOperator.getFamilyIndex(Object), AbstractXOperator.getNameIndex(Object)

getSize

public int getSize(Object referent)
Return the intrinsic size of an object, that is to say 0.

Specified by:
getSize in interface XOperator
Overrides:
getSize in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0.
See Also:
#getNaturalIndex(Object), AbstractXOperator.getTypeSize(Object), AbstractXOperator.getFamilySize(Object), AbstractXOperator.getNameSize(Object)

getTypeIndex

public int getTypeIndex(Object referent)
Return the intrinsic position of this item amongs items of the same type, that is to say 0.

Specified by:
getTypeIndex in interface XOperator
Overrides:
getTypeIndex in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0.

getTypeSize

public int getTypeSize(Object referent)
Return the intrinsic size of this item amongs items of the same type, that is to say 0.

Specified by:
getTypeSize in interface XOperator
Overrides:
getTypeSize in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0;

getFamilyIndex

public int getFamilyIndex(Object referent)
Return the intrinsic position of this item amongs items of the same family, that is to say 0.

Specified by:
getFamilyIndex in interface XOperator
Overrides:
getFamilyIndex in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0;

getFamilySize

public int getFamilySize(Object referent)
Return the intrinsic size of this item amongs items of the same family, that is to say 0.

Specified by:
getFamilySize in interface XOperator
Overrides:
getFamilySize in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0;

getNameIndex

public int getNameIndex(Object referent)
Return the intrinsic position of this item amongs items of the same name, that is to say 0.

Specified by:
getNameIndex in interface XOperator
Overrides:
getNameIndex in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0;

getNameSize

public int getNameSize(Object referent)
Return the intrinsic position of this item amongs items of the same name, that is to say 0.

Specified by:
getNameSize in interface XOperator
Overrides:
getNameSize in class AbstractXOperator
Parameters:
referent - The referent object.
Returns:
0;