org.ceryle.xtm
Class XtmScope

java.lang.Object
  extended by org.ceryle.xtm.XtmNode
      extended by org.ceryle.xtm.XtmScope
All Implemented Interfaces:
Comparable, Iterator, Constants

public class XtmScope
extends XtmNode
implements Comparable

Defines a topic map scope, such that instances of this class are objects containing the features of XTM scopes, designed to assist in building in-memory representations via the XtmProcessor class. XtmScope objects are not representations of XTM <scope> Elements.

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

Field Summary
static String UNCONSTRAINED_SCOPE
          A String constant indicating the unconstrained scope.
 
Fields inherited from class org.ceryle.xtm.XtmNode
ASSOCIATION_NODE, BASENAME_NODE, BASENAMESTRING_NODE, COMMENT_NODE, DOCUMENT_NODE, GrpSep, GRPSEP, id, INSTANCEOF_NODE, MEMBER_NODE, MERGEMAP_NODE, NODE, NonType, NONTYPE, OCCURRENCE_NODE, PARAMETERS_NODE, PROCESSING_INSTRUCTION_NODE, RecSep, RECSEP, REFERENCE_NODE, RESOURCEDATA_NODE, RESOURCEREF_NODE, ROLESPEC_NODE, SCOPE_NODE, SUBJECTIDENTITY_NODE, SUBJECTINDICATORREF_NODE, TOPIC_NODE, TOPICMAP_NODE, TOPICREF_NODE, VARIANT_NODE, VARIANTNAME_NODE
 
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
XtmScope()
          Default constructor.
XtmScope(Collection xrefs)
          Constructor with Collection xrefs containing one or more XtmReference objects indicating the scope.
XtmScope(String id)
          Constructor with String id.
XtmScope(URL url)
          Constructor providing the URI to be used as the xlink:href value of a <topicRef> Element for this XtmScope.
XtmScope(XtmReference xref)
          Constructor with a XtmReference xref indicating the scope.
 
Method Summary
 void addReference(XtmReference xref)
          Adds the XtmReference xref to the topic references in this XtmScope.
 void addScope(XtmScope newscope)
          Adds the XtmReference objects contained with the supplied XtmScope scope to this XtmScope (effectively, a merge).
 int compareTo(Object o)
          Compares the hash of this XtmScope with the provided Object for order.
 boolean containsReference(XtmReference xref)
          Returns true if any of this XtmScope's references has a URI matching that of the provided xref, false if not (or if this XtmScope has no references).
 String getHash()
          Return an int hashcode generated from this XtmScope's XtmReferences.
 String getName()
          Returns a String containing the name of this XTM element type.
 short getNodeType()
          A short integer indicating what type of node this is.
 Collection getReferences()
          Returns a Collection containing the XtmReference objects of this XtmScope.
 Iterator getScope()
          Returns an Iterator containing the XtmReference objects of this XtmScope.
 
Methods inherited from class org.ceryle.xtm.XtmNode
addPI, getID, getPI, getPIs, hasNext, next, remove, removePI, setID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNCONSTRAINED_SCOPE

public static final String UNCONSTRAINED_SCOPE
A String constant indicating the unconstrained scope.

See Also:
Constant Field Values
Constructor Detail

XtmScope

public XtmScope()
         throws XtmException
Default constructor.

Throws:
XtmException

XtmScope

public XtmScope(String id)
         throws XtmException
Constructor with String id.

Throws:
XtmException

XtmScope

public XtmScope(URL url)
         throws XtmException
Constructor providing the URI to be used as the xlink:href value of a <topicRef> Element for this XtmScope. If scopes using other reference types are desired, use a constructor that accepts an XtmReference. This is a convenience method. In an ideal world, this would use a URI rather than a URL.

Throws:
XtmException

XtmScope

public XtmScope(XtmReference xref)
         throws XtmException
Constructor with a XtmReference xref indicating the scope.

Throws:
XtmException

XtmScope

public XtmScope(Collection xrefs)
         throws XtmException
Constructor with Collection xrefs containing one or more XtmReference objects indicating the scope.

Throws:
XtmException
Method Detail

getName

public String getName()
Returns a String containing the name of this XTM element type.

Overrides:
getName in class XtmNode

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.

Overrides:
getNodeType in class XtmNode

getScope

public Iterator getScope()
Returns an Iterator containing the XtmReference objects of this XtmScope.


getReferences

public Collection getReferences()
Returns a Collection containing the XtmReference objects of this XtmScope.


containsReference

public boolean containsReference(XtmReference xref)
Returns true if any of this XtmScope's references has a URI matching that of the provided xref, false if not (or if this XtmScope has no references).


addScope

public void addScope(XtmScope newscope)
Adds the XtmReference objects contained with the supplied XtmScope scope to this XtmScope (effectively, a merge).


addReference

public void addReference(XtmReference xref)
Adds the XtmReference xref to the topic references in this XtmScope.


getHash

public String getHash()
Return an int hashcode generated from this XtmScope's XtmReferences. The hash code is built from a sorted list of int values representing the URIs of the XtmReferences' URIs, with a Unicode RECORD SEPARATOR (U+001E) character as delimiter.


compareTo

public int compareTo(Object o)
Compares the hash of this XtmScope with the provided Object for order.

Specified by:
compareTo in interface Comparable


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