Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.io.gml.reader.internal.instance
Class GroupPath

java.lang.Object
  extended by eu.esdihumboldt.hale.io.gml.reader.internal.instance.GroupPath

public class GroupPath
extends Object

Represents a path of groups in two parts, the existing parent MutableGroups and the non-existent children represented by a DefinitionGroup

Author:
Simon Templer

Constructor Summary
GroupPath(List<MutableGroup> parents, List<DefinitionGroup> children)
          Create a group path
 
Method Summary
 boolean allowAdd(QName propertyName, boolean strict)
          Determines if the adding a property value for the given property to the last element in the path is allowed.
protected  List<MutableGroup> createChildGroups()
          Create groups for the children in the path (which are only represented as definitions).
 Stack<MutableGroup> getAllGroups(boolean strict)
          Get all groups in the path.

Will create the child groups for which only definitions are present and update the path accordingly before returning all group objects.
 List<DefinitionGroup> getChildren()
           
 MutableGroup getLast(boolean strict)
          Get the last group in the path.

Will create the child groups for which only definitions are present and update the path accordingly before getting the last group object.
 DefinitionGroup getLastDefinition()
          Get the last definition group in the path
 List<MutableGroup> getParents()
           
 boolean isValid()
          Determines if the group path in this configuration is valid in respect to the creation of new groups based on the contained definition groups.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupPath

public GroupPath(List<MutableGroup> parents,
                 List<DefinitionGroup> children)
Create a group path

Parameters:
parents - the list of parent groups, may neither be null nor empty
children - the list of child definition groups, may be null
Method Detail

getParents

public List<MutableGroup> getParents()
Returns:
the parents

getChildren

public List<DefinitionGroup> getChildren()
Returns:
the children, may be null

createChildGroups

protected List<MutableGroup> createChildGroups()
Create groups for the children in the path (which are only represented as definitions). May only be called if the path is valid. This will also update the path to include the groups instead of the definitions.

Returns:
the list of created groups
See Also:
isValid()

isValid

public boolean isValid()
Determines if the group path in this configuration is valid in respect to the creation of new groups based on the contained definition groups.

Returns:
if the path is valid

allowAdd

public boolean allowAdd(QName propertyName,
                        boolean strict)
Determines if the adding a property value for the given property to the last element in the path is allowed.

Parameters:
propertyName - the property name
strict - states if additional checks are applied apart from whether the property exists
Returns:
if adding the property value to the last element in the path is allowed

getLastDefinition

public DefinitionGroup getLastDefinition()
Get the last definition group in the path

Returns:
the last definition group

getLast

public MutableGroup getLast(boolean strict)
                     throws IllegalStateException
Get the last group in the path.

Will create the child groups for which only definitions are present and update the path accordingly before getting the last group object.

Parameters:
strict - if the path should be checked for validity
Returns:
the last group in the path
Throws:
IllegalStateException - if the path is not valid

getAllGroups

public Stack<MutableGroup> getAllGroups(boolean strict)
                                 throws IllegalStateException
Get all groups in the path.

Will create the child groups for which only definitions are present and update the path accordingly before returning all group objects.

Parameters:
strict - if the path should be checked for validity
Returns:
the all groups in the path
Throws:
IllegalStateException - if the path is not valid

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d