org.tm4j.topicmap.unified
Class UnifiedVariant

java.lang.Object
  extended byorg.tm4j.topicmap.unified.UnifiedTopicMapObject
      extended byorg.tm4j.topicmap.unified.UnifiedVariant
All Implemented Interfaces:
TopicMapObject, Variant, VariantContainer

public class UnifiedVariant
extends UnifiedTopicMapObject
implements Variant


Field Summary
 
Fields inherited from class org.tm4j.topicmap.unified.UnifiedTopicMapObject
m_tm
 
Method Summary
 void addParameter(Topic param)
          Adds a parameter to the variant.
 void addVariant(Variant v)
          Adds a new child variant to this object.
 Variant createVariant(java.lang.String id)
          Creates a new child variant of this object.
 VariantName createVariantName(java.lang.String id)
          Creates a new VariantName as a child of this Variant.
 java.util.Collection getParameters()
          Returns the parameters of this variant as an unmodifiable Collection of Topic objects.
 java.util.Collection getParameters(boolean all)
          Returns the parameters of this variant and, if so specified, all ancestor variants, as an unmodifiable Collection of Topic objects.
 VariantContainer getParent()
          Returns the object containing this variant.
 VariantName getVariantName()
          Returns the name for this Variant.
 java.util.Collection getVariants()
          Returns the child Variants as an unmodifiable collection of Variant objects.
 void setParameters(Topic[] params)
          Sets the parameters of this variant, overwriting any existing parameters.
 void setParent(VariantContainer vc)
           
 void setVariantName(VariantName vn)
          Sets the VariantName contained by this Variant.
 void setVariants(Variant[] v)
          Sets the child variants of this object.
 
Methods inherited from class org.tm4j.topicmap.unified.UnifiedTopicMapObject
addMultiValuePropertyChangeListener, addMultiValuePropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addSourceLocator, addVetoableChangeListener, destroy, equals, fireMultiValuePropertyChange, fireMultiValuePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getBaseObject, getID, getResourceLocator, getSourceLocators, getTopicMap, hashCode, removeMultiValuePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, removeSourceLocator, removeVetoableChangeListener, setID, setResourceLocator, unsupported
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tm4j.topicmap.TopicMapObject
addMultiValuePropertyChangeListener, addMultiValuePropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addSourceLocator, addVetoableChangeListener, destroy, fireMultiValuePropertyChange, fireMultiValuePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getID, getResourceLocator, getSourceLocators, getTopicMap, removeMultiValuePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, removeSourceLocator, removeVetoableChangeListener, setID, setResourceLocator
 

Method Detail

addParameter

public void addParameter(Topic param)
Description copied from interface: Variant
Adds a parameter to the variant.

Specified by:
addParameter in interface Variant
Parameters:
param - The topic reference to be used as a variant parameter.

getParameters

public java.util.Collection getParameters()
Description copied from interface: Variant
Returns the parameters of this variant as an unmodifiable Collection of Topic objects. Note that this method only provides the parameters specifically defined on this Variant itself. In order to retrieve a collection of all parameters defined on this variant and its ancestors, use Variant.getParameters(boolean).

Specified by:
getParameters in interface Variant
Returns:
The collection of Topics defining this variant's parameters. If no parameters are currently defined on this variant, the returned collection is empty; it is never null.

getParameters

public java.util.Collection getParameters(boolean all)
Description copied from interface: Variant
Returns the parameters of this variant and, if so specified, all ancestor variants, as an unmodifiable Collection of Topic objects.

Specified by:
getParameters in interface Variant
Parameters:
all - If true, then parameters from all ancestor containers are returned. If false, just the parameters of this Variant itself are returned.
Returns:
The collection of Topics defining this variant's parameters. If no parameters are currently defined on this variant (or ancestors), the returned collection is empty; it is never null.

getParent

public VariantContainer getParent()
Description copied from interface: Variant
Returns the object containing this variant. This may either be a BaseName, or, in case of variant nesting, another Variant.

Specified by:
getParent in interface Variant
Returns:
The containing object.

getVariantName

public VariantName getVariantName()
Description copied from interface: Variant
Returns the name for this Variant.

Specified by:
getVariantName in interface Variant

setParameters

public void setParameters(Topic[] params)
Description copied from interface: Variant
Sets the parameters of this variant, overwriting any existing parameters.

Specified by:
setParameters in interface Variant
Parameters:
params - the new set of parameters to be used with this variant. If this is null, all the existing parameters of this variant are removed.

setParent

public void setParent(VariantContainer vc)

setVariantName

public void setVariantName(VariantName vn)
Description copied from interface: Variant
Sets the VariantName contained by this Variant. If the Variant already has a child VariantName, it will be replaced by the one passed to this method. If the value passed to this method is null, the existing VariantName child will be removed from this object.

Specified by:
setVariantName in interface Variant
Parameters:
vn - The VariantName child to be added to this object, or null to remove any existing child from this object.

createVariantName

public VariantName createVariantName(java.lang.String id)
Description copied from interface: Variant
Creates a new VariantName as a child of this Variant. Thw new VariantName will replace any existing VariantName as the only child of this Variant.

Specified by:
createVariantName in interface Variant
Parameters:
id - the unique object id to be assigned to the new VariantName object. If this parameter is null, the back-end will assign an ID to the newly created object.
Returns:
the newly created VariantName object.

getVariants

public java.util.Collection getVariants()
Description copied from interface: VariantContainer
Returns the child Variants as an unmodifiable collection of Variant objects. Note that this method will not descend any nesting of variants inside variants, but will instead only return the immediate child variants of this VariantContainer.

Specified by:
getVariants in interface VariantContainer
Returns:
The collection of direct child Variants. If no child variants are currently defined on this object, the returned collection is empty; it is never null.

addVariant

public void addVariant(Variant v)
Description copied from interface: VariantContainer
Adds a new child variant to this object.

Specified by:
addVariant in interface VariantContainer
Parameters:
v - the new child Variant.

setVariants

public void setVariants(Variant[] v)
Description copied from interface: VariantContainer
Sets the child variants of this object. All existing child variants are previously removed.

Specified by:
setVariants in interface VariantContainer
Parameters:
v - the new set of child variants this object contains. If this is null, all the existing variants contained in this object are removed.

createVariant

public Variant createVariant(java.lang.String id)
Description copied from interface: VariantContainer
Creates a new child variant of this object.

Specified by:
createVariant in interface VariantContainer
Parameters:
id - the unique identifier to be assigned to the newly created Variant. If null is passed in, then the backend will generate a unique identifier for the new Variant.
Returns:
the newly created Variant. The new Variant has no data or dataLocator set and no parameters specified.