org.ceryle.xtm
Class XtmVariant

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

public class XtmVariant
extends XtmNode
implements Comparable

Defines a base name variant, such that instances of this class are objects containing the variant names of XtmBaseName objects, designed to assist in building in-memory representations via the XtmProcessor class. XtmVariants are not representations of XTM <variant> Elements. Note that constructors with IDs are not provided for XtmVariants, though the ID can still be set using setID().

An XtmVariant contains one XtmParameters object, which contains all of the XtmReferences acting as parameters of this XtmVariant.

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

Field Summary
 
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
XtmVariant()
          Default constructor.
XtmVariant(String id)
          Constructor with supplied String ID value id.
XtmVariant(XtmParameters params)
          Constructor providing an XtmParameters object, used as the parameters of this XtmVariant.
XtmVariant(XtmParameters params, String data)
          XtmVariant constructor provided an XtmParameters params and a String resourceData to be used as the variant name, i.e., the content of a <resourceData> Element within the <variantName> Element.
XtmVariant(XtmParameters params, XtmReference resourceRef)
          XtmVariant constructor provided an XtmParameters params and a XtmReference resourceRef to be used as the contents of a <variantName> Element.
XtmVariant(XtmParameters params, XtmResourceData resourceData)
          XtmVariant constructor provided an XtmParameters params and a XtmResourceData resourceData object to be used as the variant name within the <variantName> Element.
 
Method Summary
 void addParameter(XtmReference parameter)
          Add an XtmReference parameter as a parameter of this XtmVariant.
 void addParameters(XtmParameters params)
          Add XtmParameters params as parameters of this XtmVariant.
 void addVariant(XtmVariant variant)
          Recursively add an XtmVariant variant as a variant of this XtmVariant.
 int compareTo(Object o)
          Compares the hash of this XtmVariant with the provided Object (which should be another XtmVariant) for order.
 String getHash()
          Return a coded String that is a hashed version of this XtmVariant.
 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.
 XtmParameters getParameters()
          Return the XtmParameters object representing the parameters of this XtmVariant.
 XtmNode getVariantName()
          Return the XtmResourceData or XtmReference representing the resource of this XtmVariant.
 Iterator getVariants()
          Return an Iterator containing an XtmVariants recursively contained within this one, null if none have been defined.
 boolean hasParameter(XtmReference xref)
          Return true if an XtmReference object is found amongst the parameters of this variant having a URI string matching the one provided.
 void setVariantName(String resourceData)
          Set the value of the variant name of this XtmVariant to the XtmResourceData created from the String resourceData.
 void setVariantName(XtmReference resourceRef)
          Set the value of the variant name of this XtmVariant to the XtmReference resourceRef.
 void setVariantName(XtmResourceData resourceData)
          Set the value of the variant name of this XtmVariant to the XtmResourceData resourceData.
 
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
 

Constructor Detail

XtmVariant

public XtmVariant()
           throws XtmException
Default constructor.

Throws:
XtmException

XtmVariant

public XtmVariant(String id)
           throws XtmException
Constructor with supplied String ID value id.

Parameters:
id - the ID of this XtmVariant.
Throws:
XtmException

XtmVariant

public XtmVariant(XtmParameters params)
           throws XtmException
Constructor providing an XtmParameters object, used as the parameters of this XtmVariant. This is a convenience method.

Parameters:
params - the XtmParameters used as the parameters of this XtmVariant.
Throws:
XtmException

XtmVariant

public XtmVariant(XtmParameters params,
                  XtmResourceData resourceData)
           throws XtmException
XtmVariant constructor provided an XtmParameters params and a XtmResourceData resourceData object to be used as the variant name within the <variantName> Element.

Parameters:
params - the XtmParameters used as the parameters of this XtmVariant.
resourceData - the XtmResourceData used as the resource of this XtmVariant.
Throws:
XtmException

XtmVariant

public XtmVariant(XtmParameters params,
                  String data)
           throws XtmException
XtmVariant constructor provided an XtmParameters params and a String resourceData to be used as the variant name, i.e., the content of a <resourceData> Element within the <variantName> Element. This is a convenience method.

Parameters:
params - the XtmParameters used as the parameters of this XtmVariant.
data - the String used as the resource data of this XtmVariant.
Throws:
XtmException

XtmVariant

public XtmVariant(XtmParameters params,
                  XtmReference resourceRef)
           throws XtmException
XtmVariant constructor provided an XtmParameters params and a XtmReference resourceRef to be used as the contents of a <variantName> Element.

Parameters:
params - the XtmParameters used as the parameters of this XtmVariant.
resourceRef - the XtmReference used as the resource of this XtmVariant.
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

addParameter

public void addParameter(XtmReference parameter)
                  throws XtmException
Add an XtmReference parameter as a parameter of this XtmVariant. If the XtmParameters object does not exist, this will create one. If one already exists, this will add the XtmReference to the existing parameters.

Throws:
XtmException

addParameters

public void addParameters(XtmParameters params)
Add XtmParameters params as parameters of this XtmVariant. If an XtmParameters object does not exist, the provided one will serve this role. If one already exists, this will add the XtmReferences contained within the provided XtmParameters object to the existing parameters.


getParameters

public XtmParameters getParameters()
Return the XtmParameters object representing the parameters of this XtmVariant. This will return null if it has not been set.


hasParameter

public boolean hasParameter(XtmReference xref)
Return true if an XtmReference object is found amongst the parameters of this variant having a URI string matching the one provided.


setVariantName

public void setVariantName(XtmResourceData resourceData)
                    throws XtmException
Set the value of the variant name of this XtmVariant to the XtmResourceData resourceData.

Parameters:
resourceData - The XtmResourceData to be used as the resource data value.
Throws:
XtmException - if resourceRef has already been set

setVariantName

public void setVariantName(String resourceData)
                    throws XtmException
Set the value of the variant name of this XtmVariant to the XtmResourceData created from the String resourceData. This is a convenience method.

Parameters:
resourceData - The String to be used as the resource data value.
Throws:
XtmException - if resourceRef has already been set

setVariantName

public void setVariantName(XtmReference resourceRef)
                    throws XtmException
Set the value of the variant name of this XtmVariant to the XtmReference resourceRef.

Parameters:
resourceRef - The XtmReference to be used as the resource reference value.
Throws:
XtmException - if resourceData has already been set

getVariantName

public XtmNode getVariantName()
Return the XtmResourceData or XtmReference representing the resource of this XtmVariant. This will return null if neither have been set.

Returns:
An XtmNode, either an XtmReference or XtmResourceData representing the resource of this XtmVariant.

addVariant

public void addVariant(XtmVariant variant)
Recursively add an XtmVariant variant as a variant of this XtmVariant.


getVariants

public Iterator getVariants()
Return an Iterator containing an XtmVariants recursively contained within this one, null if none have been defined.


getHash

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

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

compareTo

public int compareTo(Object o)
Compares the hash of this XtmVariant with the provided Object (which should be another XtmVariant) for order.

Specified by:
compareTo in interface Comparable


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