org.ceryle.xtm
Class XtmNode

java.lang.Object
  extended by org.ceryle.xtm.XtmNode
All Implemented Interfaces:
Iterator, Constants
Direct Known Subclasses:
XtmAssociation, XtmBaseName, XtmComment, XtmDocument, XtmMember, XtmOccurrence, XtmParameters, XtmProcessingInstruction, XtmReference, XtmResourceData, XtmScope, XtmTopic, XtmTopicMap, XtmVariant

public abstract class XtmNode
extends Object
implements Constants, Iterator

Defines a base topic map node (or object) class, designed to assist in building in-memory representations via the XtmProcessor class.

Since:
JDK1.3
Version:
$Id: XtmNode.java,v 3.4 2007-06-15 12:10:35 altheim Exp $
Author:
Murray Altheim

Field Summary
static short ASSOCIATION_NODE
          This XtmNode represents an XTM association element.
static short BASENAME_NODE
          This XtmNode represents an XTM basename element.
static short BASENAMESTRING_NODE
          Represents an XTM <baseNameString> element (not an XtmNode class).
static short COMMENT_NODE
          This XtmNode represents an XML comment.
static short DOCUMENT_NODE
          This XtmNode represents an XTM document (not the <topicMap> element).
static String GrpSep
           
static int GRPSEP
           
protected  String id
          The ID of this XtmNode.
static short INSTANCEOF_NODE
          Represents an XTM <instanceOf> element (not an XtmNode class).
static short MEMBER_NODE
          This XtmNode represents an XTM member element.
static short MERGEMAP_NODE
          Represents an XTM <mergeMap> element (not an XtmNode class).
static short NODE
          This abstractly represents an XTM node.
static String NonType
           
static int NONTYPE
           
static short OCCURRENCE_NODE
          This XtmNode represents an XTM occurrence element.
static short PARAMETERS_NODE
          This XtmNode represents an XTM parameters element.
static short PROCESSING_INSTRUCTION_NODE
          This XtmNode represents an XML processing instruction.
static String RecSep
           
static int RECSEP
           
static short REFERENCE_NODE
          This XtmNode represents an XTM reference (i.e., one of the three XTM reference elements).
static short RESOURCEDATA_NODE
          This XtmNode represents an XTM resourceData element.
static short RESOURCEREF_NODE
          Represents an XTM <resourceRef> element (not an XtmNode class).
static short ROLESPEC_NODE
          Represents an XTM <roleSpec> element (not an XtmNode class).
static short SCOPE_NODE
          This XtmNode represents an XTM scope element.
static short SUBJECTIDENTITY_NODE
          Represents an XTM <subjectIdentity> element (not an XtmNode class).
static short SUBJECTINDICATORREF_NODE
          Represents an XTM <subjectIndicatorRef> element (not an XtmNode class).
static short TOPIC_NODE
          This XtmNode represents an XTM topic element.
static short TOPICMAP_NODE
          This XtmNode represents an XTM topicmap element.
static short TOPICREF_NODE
          Represents an XTM <topicRef> element (not an XtmNode class).
static short VARIANT_NODE
          This XtmNode represents an XTM variant element.
static short VARIANTNAME_NODE
          Represents an XTM <variantName> element (not an XtmNode class).
 
Fields inherited from interface org.ceryle.util.Constants
Amp, AMP, Apos, APOS, APP_NAME, APP_VERSION_NAME, APP_VERSION_NUMBER, AT, BANG, BAR, BIT_dev, BIT_http, BIT_ignoreCom, BIT_merge, BIT_none, BIT_noPreload, BIT_simple, BIT_ui, BIT_unused1, BIT_unused2, BIT_unused3, BIT_validating, BIT_verbose, BIT_xcatalog, BIT_xlink, BIT_xmlnsAware, BIT_xsd, BROKB, BSlash, BSLASH, CERYLE_CREDITS_FILE, CERYLE_DATA_DIR, CERYLE_HIST_FILE, CERYLE_LICENSE_FILE, CERYLE_PREF_FILE, CERYLE_PROP, CERYLE_PROP_BASE, CERYLE_PROP_FILE, CERYLE_RSRC_DIR, CERYLE_THANKS_FILE, CFLEX, Colon, COLON, Comma, COMMA, CR, CRet, Dash, DASH, DEFAULT_DIRECTORY, DEVELOPER, DOLR, Dot, DOT, EIGHT, Ellip, EOF, EqQuot, EQUAL, Equals, False, FALSE, FileProt, Filesep, FileURL, Five, FIVE, FONTSIZES, Four, FOUR, FSchar, GCOL_PROP, GRAPH_PROP, GRAVE, GT, Hash, HASH, HOME_DIRECTORY, HOME_DIRECTORY_PATH, HOME_DIRECTORY_URL, HTML, HttpProt, HttpURL, INDENT, INDENT_0, INDENT_1, INDENT_10, INDENT_2, INDENT_3, INDENT_4, INDENT_5, INDENT_6, INDENT_7, INDENT_8, INDENT_9, INIT, LCURL, LCurly, LF, LFS, Localhost, LPAR, LParen, LS, LSBrkt, LSBrkt2, LSQB, LT, MT, NBSP, NEL, NINE, NL, NL20x, NLchar, No, Null, NULL, NULL_STATE, NumParams, One, ONE, Pathsep, Percent, PERO, PLUS, Prcnt, PS, QMark, QMARK, Quot, QUOT, RCURL, RCurly, RESOURCE_BUNDLE, RPAR, RParen, RSBrkt, RSBrkt2, RSQB, Semi, SEMI, SEVEN, SIX, Slash, SLASH, SP, SPACE, Stago, Star, STAR, Tab, TAB, Tee, Three, THREE, Tilde, TILDE, TM_PROP, True, TRUE, Two, TWO, Under, UNDER, URI, URL, VBar, WIKI_PROP, XNodePfx, XNodeURL, XtmExt, Yes, Zero, ZERO
 
Constructor Summary
XtmNode()
          Constructor with no provided ID.
XtmNode(String id)
          Constructor with provided ID.
 
Method Summary
 void addPI(XtmProcessingInstruction pi)
          Add a processing instruction (PI) to this node.
 String getID()
          Return the value of the ID of this node.
 String getName()
          Returns a String containing the name of the XTM element type that serializes this node.
 short getNodeType()
          A short integer indicating what type of node this is.
 String getPI(String target)
          Return the data content of the processing instruction whose target matches the String target, null if no match is found.
 Set getPIs()
          Return a Set containing the processing instruction mappings attached to this XtmNode, or null if there are none.
 boolean hasNext()
          Return a boolean indicating if an iteration of this node has more elements.
 Object next()
          Returns the next object in the iteration.
 void remove()
          Removes from the Collection the element last returned by the iterator.
 void removePI(String target)
          Remove the processing instruction whose target matches the String target.
 void setID(String id)
          Set the value of the ID of this XtmNode to the String id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRPSEP

public static final int GRPSEP
See Also:
Constant Field Values

GrpSep

public static final String GrpSep

RECSEP

public static final int RECSEP
See Also:
Constant Field Values

RecSep

public static final String RecSep

NONTYPE

public static final int NONTYPE
See Also:
Constant Field Values

NonType

public static final String NonType

NODE

public static final short NODE
This abstractly represents an XTM node.

See Also:
Constant Field Values

COMMENT_NODE

public static final short COMMENT_NODE
This XtmNode represents an XML comment.

See Also:
Constant Field Values

PROCESSING_INSTRUCTION_NODE

public static final short PROCESSING_INSTRUCTION_NODE
This XtmNode represents an XML processing instruction.

See Also:
Constant Field Values

DOCUMENT_NODE

public static final short DOCUMENT_NODE
This XtmNode represents an XTM document (not the <topicMap> element).

See Also:
Constant Field Values

REFERENCE_NODE

public static final short REFERENCE_NODE
This XtmNode represents an XTM reference (i.e., one of the three XTM reference elements).

See Also:
Constant Field Values

TOPICMAP_NODE

public static final short TOPICMAP_NODE
This XtmNode represents an XTM topicmap element.

See Also:
Constant Field Values

TOPIC_NODE

public static final short TOPIC_NODE
This XtmNode represents an XTM topic element.

See Also:
Constant Field Values

INSTANCEOF_NODE

public static final short INSTANCEOF_NODE
Represents an XTM <instanceOf> element (not an XtmNode class).

See Also:
Constant Field Values

SUBJECTIDENTITY_NODE

public static final short SUBJECTIDENTITY_NODE
Represents an XTM <subjectIdentity> element (not an XtmNode class).

See Also:
Constant Field Values

RESOURCEREF_NODE

public static final short RESOURCEREF_NODE
Represents an XTM <resourceRef> element (not an XtmNode class).

See Also:
Constant Field Values

SUBJECTINDICATORREF_NODE

public static final short SUBJECTINDICATORREF_NODE
Represents an XTM <subjectIndicatorRef> element (not an XtmNode class).

See Also:
Constant Field Values

TOPICREF_NODE

public static final short TOPICREF_NODE
Represents an XTM <topicRef> element (not an XtmNode class).

See Also:
Constant Field Values

BASENAME_NODE

public static final short BASENAME_NODE
This XtmNode represents an XTM basename element.

See Also:
Constant Field Values

BASENAMESTRING_NODE

public static final short BASENAMESTRING_NODE
Represents an XTM <baseNameString> element (not an XtmNode class).

See Also:
Constant Field Values

VARIANT_NODE

public static final short VARIANT_NODE
This XtmNode represents an XTM variant element.

See Also:
Constant Field Values

VARIANTNAME_NODE

public static final short VARIANTNAME_NODE
Represents an XTM <variantName> element (not an XtmNode class).

See Also:
Constant Field Values

PARAMETERS_NODE

public static final short PARAMETERS_NODE
This XtmNode represents an XTM parameters element.

See Also:
Constant Field Values

OCCURRENCE_NODE

public static final short OCCURRENCE_NODE
This XtmNode represents an XTM occurrence element.

See Also:
Constant Field Values

RESOURCEDATA_NODE

public static final short RESOURCEDATA_NODE
This XtmNode represents an XTM resourceData element.

See Also:
Constant Field Values

ASSOCIATION_NODE

public static final short ASSOCIATION_NODE
This XtmNode represents an XTM association element.

See Also:
Constant Field Values

MEMBER_NODE

public static final short MEMBER_NODE
This XtmNode represents an XTM member element.

See Also:
Constant Field Values

ROLESPEC_NODE

public static final short ROLESPEC_NODE
Represents an XTM <roleSpec> element (not an XtmNode class).

See Also:
Constant Field Values

SCOPE_NODE

public static final short SCOPE_NODE
This XtmNode represents an XTM scope element.

See Also:
Constant Field Values

MERGEMAP_NODE

public static final short MERGEMAP_NODE
Represents an XTM <mergeMap> element (not an XtmNode class).

See Also:
Constant Field Values

id

protected String id
The ID of this XtmNode.

Constructor Detail

XtmNode

public XtmNode()
Constructor with no provided ID.


XtmNode

public XtmNode(String id)
Constructor with provided ID. Note that checking for null or invalid values should be done by any classes that create XtmNode objects.

Method Detail

getName

public String getName()
Returns a String containing the name of the XTM element type that serializes this node. This method is meant to be subclassed for each node type.


getNodeType

public short getNodeType()
A short integer indicating what type of node this is. The named constants for this value are defined in the org.ceryle.XtmNode class.


setID

public void setID(String id)
Set the value of the ID of this XtmNode to the String id. Generally speaking, this is better done upon Node creation. Validation of the ID value should be done by the node generator.

Parameters:
id - The String to be used an the ID value.

getID

public String getID()
Return the value of the ID of this node.

Returns:
A String representing the ID of this Node.

addPI

public void addPI(XtmProcessingInstruction pi)
Add a processing instruction (PI) to this node. PIs are generally used for custom utility within an application, and their use here is not specified (nor are they considered part of the document tree). Because PI storage is backed by a HashMap, if an PI exists with a matching target String, it will be replaced by the new one.

Parameters:
pi - the processing instruction node.

getPI

public String getPI(String target)
Return the data content of the processing instruction whose target matches the String target, null if no match is found.

Returns:
the data content of a PI matching 'target'.

removePI

public void removePI(String target)
Remove the processing instruction whose target matches the String target.


getPIs

public Set getPIs()
Return a Set containing the processing instruction mappings attached to this XtmNode, or null if there are none. Each element in the set is a Map.Entry.

Returns:
a Set containing the PI mappings in this XtmNode.

next

public Object next()
            throws NoSuchElementException
Returns the next object in the iteration. This should be subclassed as appropriate.

Specified by:
next in interface Iterator
Returns:
the next object in the iteration.
Throws:
NoSuchElementException - if there are no more elements in this iteration.

hasNext

public boolean hasNext()
Return a boolean indicating if an iteration of this node has more elements. This should be subclassed as appropriate.

Specified by:
hasNext in interface Iterator
Returns:
A boolean value indicating if the iteration has more elements.

remove

public void remove()
            throws UnsupportedOperationException
Removes from the Collection the element last returned by the iterator. This should be subclassed as appropriate if support is desired.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - because this operation is unsupported.


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.