sk.uniba.euromath.document
Class DomPointerFactory

java.lang.Object
  extended by sk.uniba.euromath.document.DomPointerFactory

public final class DomPointerFactory
extends Object

Creates pointer into contents of document, from various parameters.

You can do following with the pointer:

Author:
Martin Vysny

Constructor Summary
DomPointerFactory()
          Constructs instance of factory with doc parameter set to null.
DomPointerFactory(DomCore doc)
          Constructs instance of factory.
 
Method Summary
 DomPointer create(Node pointsTo)
          Creates instance of pointer.
 DomPointer create(Node parent, InsertPoint ip)
          Creates instance of pointer.
 DomPointer create(Node pointsTo, int pos)
          Creates instance of pointer.
 DomPointer create(Node parent, Node pointsTo)
          Creates instance of pointer.
 DomPointer create(Node parent, Node pointsTo, int pos)
          Creates instance of pointer.
 DomPointer create(String pointsToId)
          Creates instance of pointer.
 DomPointer create(String parentId, InsertPoint ip)
          Creates instance of pointer.
 DomPointer create(String parentId, String pointsToId)
          Creates instance of pointer.
 DomPointer createFirstIn(Node parent, EnumSet<DomPointerFlag> flags)
          Creates a pointer that points onto a first 'child' of given element (a child when entity references are resolved.
 DomPointer getFirst(EnumSet<DomPointerFlag> ptrFlags)
          Returns first pointer with given flags, in the Document-order ordering.
 DomPointer getLast(EnumSet<DomPointerFlag> ptrFlags)
          Returns last pointer with given flags, in the Document-order ordering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomPointerFactory

DomPointerFactory(DomCore doc)
Constructs instance of factory.

Parameters:
doc - document, where all produced pointers will point. It may be null: then pointers created will have all IDs and rules null.

DomPointerFactory

public DomPointerFactory()
Constructs instance of factory with doc parameter set to null.

Method Detail

create

public DomPointer create(Node parent,
                         InsertPoint ip)
Creates instance of pointer.

Parameters:
parent - parent element. Pointer will point into its contents.
ip - insertpoint, where the pointer points.
Returns:
instance of pointer.

create

public DomPointer create(String parentId,
                         InsertPoint ip)
                  throws DocumentException
Creates instance of pointer.

Parameters:
parentId - id of parent element. Pointer will point into its contents.
ip - insertpoint, where the pointer points.
Returns:
instance of pointer.
Throws:
DocumentException - if id doesn't exist.

create

public DomPointer create(Node parent,
                         Node pointsTo)
Creates instance of pointer.

Parameters:
parent - parent element. Pointer will point into its contents.
pointsTo - the pointer will point onto this node. However, pointer points between the nodes, thus it will point right before this node. If null, then pointer will point at end of node sequence.
Returns:
instance of pointer.

create

public DomPointer create(Node parent,
                         Node pointsTo,
                         int pos)
Creates instance of pointer.

Parameters:
parent - parent element. Pointer will point into its contents.
pointsTo - the pointer will point onto this node. However, pointer points between the nodes, thus it will point right before this node. If null, then pointer will point at end of node sequence.
pos - if the pointsTo node denotes a text or cdata node then pos can specify the position of the character where the pointer shall point. Otherwise it must be zero.
Returns:
instance of pointer.

create

public DomPointer create(String parentId,
                         String pointsToId)
                  throws DocumentException
Creates instance of pointer.

Parameters:
parentId - parent element. Pointer will point into its contents. You may obtain the parent node by the getParentId() function
pointsToId - the pointer will point onto this node. However, pointer points between the nodes, thus it will point right before this node. If null, then pointer will point at end of node sequence. The pointer must not denote an attribute node.
Returns:
instance of pointer.
Throws:
DocumentException - if id doesn't exist.

create

public DomPointer create(String pointsToId)
                  throws DocumentException
Creates instance of pointer.

Parameters:
pointsToId - the pointer will point onto this node. However, pointer points between the nodes, thus it will point right before this node. It must not be null nor an attribute node.
Returns:
instance of pointer.
Throws:
DocumentException - if id doesn't exist.

create

public DomPointer create(Node pointsTo)
Creates instance of pointer.

Parameters:
pointsTo - the pointer will point onto this node. However, pointer points between the nodes, thus it will point right before this node. It must not be null nor an attribute node.
Returns:
instance of pointer.

create

public DomPointer create(Node pointsTo,
                         int pos)
Creates instance of pointer.

Parameters:
pointsTo - the pointer will point onto this node. However, pointer points between the nodes, thus it will point right before this node. It must not be null nor an attribute node.
pos - if the pointsTo node denotes a text or cdata node then pos can specify the position of the character where the pointer shall point. Otherwise it must be zero.
Returns:
instance of pointer.

createFirstIn

public DomPointer createFirstIn(Node parent,
                                EnumSet<DomPointerFlag> flags)
Creates a pointer that points onto a first 'child' of given element (a child when entity references are resolved. However the flag to traverse through entity references must be specified). The pointer must comply given flags. The pointer must have parentElement equal to given parent. If no such pointer is applicable then null is returned. Only the DONT_GO_INTO_ELEMENTS flag is always turned on, other flags needs to be specified.

Parameters:
parent - the parent element or document node
flags - flags which must the result pointer comply.
Returns:
the pointer to first child that obeys given flags, or null if no such pointer exists.

getFirst

public DomPointer getFirst(EnumSet<DomPointerFlag> ptrFlags)
Returns first pointer with given flags, in the Document-order ordering.

Parameters:
ptrFlags - flags that the returned pointer must comply.
Returns:
the pointer instance. Depending on given flags, it may point outside the root element.

getLast

public DomPointer getLast(EnumSet<DomPointerFlag> ptrFlags)
Returns last pointer with given flags, in the Document-order ordering.

Parameters:
ptrFlags - flags that the returned pointer must comply.
Returns:
the pointer instance. Depending on given flags, it may point outside the root element.


Copyright 2003-2003-2006 null. All Rights Reserved.