org.ceryle.xtm
Class XtmBaseName

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

public class XtmBaseName
extends XtmNode
implements Constants, Comparable

Defines a topic base name, such that instances of this class are objects containing the base names of XTM topics, designed to assist in building representations via the XtmProcessor class. XtmBaseName objects are not representations of XTM <baseName> Elements.

Note that display names in XTM can be represented as variants on a specific base name, using a "display" PSI as the parameter of a basename variant. The setting and getting of such display names here allows both an addDisplayName() and setDisplayName() method. The latter eliminates any other display name variants and sets a single display name.

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

Field Summary
protected  String baseNameString
          The String containing the base name string of this XtmBaseName.
protected  String baseNameStringId
          The String containing this XtmBaseName's base name string ID.
static boolean caseSensitive
          When true, hash-based comparisons of base name values are case sensitive.
protected  XtmScope scope
          The XtmScope object establishing the scope for this XtmBaseName.
protected  TreeSet variants
          The TreeSet containing the variants of this XtmBaseName, comprising zero or more XtmVariant objects.
 
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
XtmBaseName()
          XtmBaseName constructor.
XtmBaseName(String id)
          XtmBaseName constructor with String id.
XtmBaseName(String id, XtmScope scopeRef, String baseNameString)
          XtmBaseName constructor with ID, scope and baseNameString.
XtmBaseName(XtmScope scopeRef, String baseNameString)
          XtmBaseName constructor with scope and baseNameString.
 
Method Summary
 void addDisplayName(String name)
          Add a display name whose value is name as a variant of this XtmBaseName.
 void addSortName(String name)
          Add a sort name whose value is name as a variant of this XtmBaseName.
 void addVariant(XtmVariant variant)
          Add an XtmVariant variant as a variant of this XtmBaseName.
 int compareTo(Object o)
          Compares the hash of this XtmBaseName with the provided Object (which should be another XtmBaseName) for order.
 String getBaseNameString()
          Return a String representing the base name string of this XtmBaseName.
 String getBaseNameStringId()
          Return a String containing the baseNameString ID.
 String getHash()
          Return a coded String that is a hashed version of this XtmBaseName.
 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.
 XtmScope getScope()
          Returns the scope of this XtmBaseName, null if not set.
 Iterator getVariants()
          Returns any XtmVariants of this XtmBaseName, null if none have been defined.
 boolean removeVariant(XtmVariant variant)
          Remove an XtmVariant variant from this XtmBaseName.
 void setBaseNameString(String baseNameString)
          Set the value of this XtmBaseName's base name string to the String baseNameString.
 void setBaseNameStringId(String id)
          Set the value of the baseNameString ID to the String id.
 void setDisplayName(String name)
          Sets the display name whose value is name as the sole display variant of this XtmBaseName, removing any other display variants.
 void setScope(XtmScope scopeRef)
          Set the scope of this XtmBaseName to the XtmScope scopeRef.
 
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

caseSensitive

public static boolean caseSensitive
When true, hash-based comparisons of base name values are case sensitive. Default is false.


scope

protected XtmScope scope
The XtmScope object establishing the scope for this XtmBaseName.


variants

protected TreeSet variants
The TreeSet containing the variants of this XtmBaseName, comprising zero or more XtmVariant objects.


baseNameString

protected String baseNameString
The String containing the base name string of this XtmBaseName.


baseNameStringId

protected String baseNameStringId
The String containing this XtmBaseName's base name string ID.

Constructor Detail

XtmBaseName

public XtmBaseName()
            throws XtmException
XtmBaseName constructor.

Throws:
XtmException

XtmBaseName

public XtmBaseName(String id)
            throws XtmException
XtmBaseName constructor with String id.

Throws:
XtmException

XtmBaseName

public XtmBaseName(XtmScope scopeRef,
                   String baseNameString)
            throws XtmException
XtmBaseName constructor with scope and baseNameString.

Throws:
XtmException

XtmBaseName

public XtmBaseName(String id,
                   XtmScope scopeRef,
                   String baseNameString)
            throws XtmException
XtmBaseName constructor with ID, scope and baseNameString.

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

setBaseNameString

public void setBaseNameString(String baseNameString)
Set the value of this XtmBaseName's base name string to the String baseNameString.

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

getBaseNameString

public String getBaseNameString()
Return a String representing the base name string of this XtmBaseName. This will return null if it has not been set.

Returns:
A String representing the base name string of this XtmBaseName.

setBaseNameStringId

public void setBaseNameStringId(String id)
Set the value of the baseNameString ID to the String id.

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

getBaseNameStringId

public String getBaseNameStringId()
Return a String containing the baseNameString ID. This will return null if it has not been set.

Returns:
A String containing the ID of the baseNameString, null if not set.

setScope

public void setScope(XtmScope scopeRef)
              throws XtmException
Set the scope of this XtmBaseName to the XtmScope scopeRef.

Parameters:
scopeRef - The XtmScope to be set for this XtmBaseName.
Throws:
XtmException - if the scope has already been set.

getScope

public XtmScope getScope()
Returns the scope of this XtmBaseName, null if not set.


addVariant

public void addVariant(XtmVariant variant)
Add an XtmVariant variant as a variant of this XtmBaseName.

Parameters:
variant - The XtmVariant to be added as a variant of this XtmBaseName

removeVariant

public boolean removeVariant(XtmVariant variant)
Remove an XtmVariant variant from this XtmBaseName. Returns true if the variant was a member of the set of variants, false otherwise.

Parameters:
variant - the XtmVariant to be removed from this XtmBaseName
Returns:
true if the variant was a member of the set of variants

getVariants

public Iterator getVariants()
Returns any XtmVariants of this XtmBaseName, null if none have been defined.


addSortName

public void addSortName(String name)
                 throws XtmException
Add a sort name whose value is name as a variant of this XtmBaseName. This is a convenience method.

Parameters:
name - A String containing a sort name to be added as an XtmVariant to this XtmBaseName.
Throws:
XtmException

addDisplayName

public void addDisplayName(String name)
                    throws XtmException
Add a display name whose value is name as a variant of this XtmBaseName. This is a convenience method.

Parameters:
name - A String containing a display name to be added as an XtmVariant to this XtmBaseName.
Throws:
XtmException

setDisplayName

public void setDisplayName(String name)
                    throws XtmException
Sets the display name whose value is name as the sole display variant of this XtmBaseName, removing any other display variants. This is a convenience method.

Parameters:
name - the display name as a String
Throws:
XtmException

compareTo

public int compareTo(Object o)
Compares the hash of this XtmBaseName with the provided Object (which should be another XtmBaseName) for order. If baseNameString has not been set, returns Integer.MIN_VALUE.

Specified by:
compareTo in interface Comparable

getHash

public String getHash()
Return a coded String that is a hashed version of this XtmBaseName. This is generated and stored within this XtmBaseName object only if requested, and regenerated only if the scope or base name string are altered.

Returns:
A coded String representing the scoped base name string of this XtmBaseName.


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