ARoad0.gBase
Class NameISTreeImpl

java.lang.Object
  extended by ARoad0.gBase.NameTreeImpl
      extended by ARoad0.gBase.NameISTreeImpl
All Implemented Interfaces:
ImmutableNameISTree, ImmutableNameTree, java.io.Serializable, java.lang.Cloneable

public class NameISTreeImpl
extends NameTreeImpl
implements ImmutableNameISTree

This class is responsible to manage for IS nametrees, a tree of ImmutableNames with specialized links to the other nodes. Most of the properties are directly managed by the calling class. The ISFactoryUtilityImpl class provides the constraints on the nodes inheritance in the nametree.

A node in an ImmutableNameISTree may have to apply some inner properties or some constraints in its links to other nodes of the whole nametree:

- 'Open' is a mandatory node property which has the value 'true' if the node is active, like an open ACS, subACS or Composite ACS/subACS, which is currently opened in the program, or if the node is a passive one as a the direct or indirect parent of an opened active node.

- 'ExtendedVisibleSpace' is a mandatory node property which extends the parent children (if ImmutableNameTree.isHubNode is true) and the ImmutableNameTree areas of the node, if any. This property is an ImmutableName/String Map:

mandatory key: node_name;

the possible String values are ImmutableNameISTree constants:

ALL_THE_IS_SPACE (the default value),

ONE_STEP_NODES_SPACE, TWO_STEPS_NODES_SPACE, THREE_STEPS_NODES_SPACE,

DIRECT_CHILDREN_SPACE, INDIRECT_CHILDREN_SPACE,

PARENT_INDIRECT_CHILDREN_SPACE, PARENT_SPACE,

NO_VISIBLE_SPACE.

- 'Alternates' is an optional node property, used only for the Alternate relation, with an ImmutableName/ImmutableName[] Map:

mandatory key: node_name for a ground ACS or subACS;

the values are the names of the alternates for the key (limited to 4).

- 'MandatoryPaths' is an optional node property, used only for the Composites which are implemented as ImmutableNameTree.Areas, with an ImmutableName/ImmutableName[] Map:

optional key: node_name is the beginning of the path;

value: the optional array of node names is the structurally-mandatory path to go accross, where the structure is a one-item List, or a List

(first_node, second_node, beginning_node, third_node, fourth_node, beginning_node),

which indicates that there are two paths: from beginning_node to second_node,

and from beginning_node to third_node and fourth_node,

and (feature to be implemented) where all the nodes are in the visible space of the beginning node.

The use of this property in BaseManagerimpl is to set the unique composite of a subcomposite.

- 'Links' is an optional node property, for IS nametrees, with an ImmutableName/String[] map.

Each property may have any format, and is defined by the user of this class. The key is usually a node name.

The Links map is used for IS nametrees, and the ACS factory initializes the ImmutableNameISTree links following some specific and complex uses.

All the properties of a ImmutableNameISTree are independant to the others. A node which is opened or closed may have any visible space, any mandatory paths and any links. Before the use of the data about a mandatory path or a link, it is recommanded to see if the relevant node is opened or not. See also the properties 'getNodeType' and 'isHubNode' in the super class.

See Also:
BaseManagerImpl.addSecondaryPropertiesToAcsOrSubNode(ARoad0.gBaseInterface.ImmutableName, ARoad0.gBaseInterface.ImmutableName, boolean, ARoad0.gBaseInterface.ImmutableName, ARoad0.gBaseInterface.ImmutableName[], java.util.Map, boolean), Serialized Form

Field Summary
static java.lang.String ALL_THE_IS_SPACE
          to see all the space
static java.lang.String DIRECT_CHILDREN_SPACE
          to see the direct children.
static NameISTreeImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
static java.lang.String INDIRECT_CHILDREN_SPACE
          to see the direct and all the indirect children, whatever their levels.
private static java.util.ArrayList<java.lang.String> L_VISIBLE_SPACES
          The list of the allowed values for the visible space.
private  java.util.Map<ImmutableName,ImmutableName[]> m_Alternates_
          Optional node property for the Alternate relation: mandatory key: node_name for a ground ACS or subACS; the values are the names of the alternates for the key.
private  java.util.Map<ImmutableName,java.lang.String> m_ExtendedVisibleSpaces_
          ImmutableName/String map of visible spaces for a node, which extends the parent children (if ImmutableNameTree.isHubNode is true) and the ImmutableNameTree areas of the node, if any.
private  java.util.Map<ImmutableName,java.lang.String[]> m_Links_
          ImmutableName/String[] map of optional links which are managed by the user of this class It is an optional node property with an ImmutableName/String[] map: the optional key is the node or area name, or the sum of two node names, the value is an optional String array, where all the properties are also optional and without constraints on the format.
private  java.util.Map<ImmutableName,ImmutableName[]> m_MandatoryPaths_
          ImmutableName/ImmutableName[] map of the optional mandatory paths It is an optional node property: optional key: node_name is the beginning of the first path; value: the optional array of node names is the mandatory paths to go accross (if rights allow it), where the structure is a one-item List, or a List (first_node, second_node, beginning_node, third_node, fourth_node, beginning_node), which indicates that there are two paths: from beginning_node to second_node, and from beginning_node to third_node and fourth_node, and where all the nodes are in the visible space of the beginning node
private  java.util.Map<ImmutableName,java.lang.Boolean> m_OpenNodes_
          ImmutableName/Boolean map of the state open/closed of each node.
static java.lang.String NO_VISIBLE_SPACE
          to see nothing; the closed visible space.
static java.lang.String ONE_STEP_NODES_SPACE
          to see the parent and the direct children of the node.
static java.lang.String PARENT_INDIRECT_CHILDREN_SPACE
          to see the parent, the direct and all the indirect children, whatever theirs levels.
static java.lang.String PARENT_SPACE
          to see the parent.
static java.io.ObjectStreamField[] serialPersistentFields
          standardized variables for the serialization
private static long serialVersionUID
           
static java.lang.String THREE_STEPS_NODES_SPACE
          to see the parent, the first two-levels parents of this parent, the direct children and the first two-levels children of these direct children.
static java.lang.String TWO_STEPS_NODES_SPACE
          to see the parent and the parent of this parent, the direct children and the direct children of these direct children.
 
Fields inherited from class ARoad0.gBase.NameTreeImpl
INCREMENT_CAPACITY, INITIAL_CAPACITY, l_NodeDescriptors_, m_Areas_, m_Levels_, PRIME
 
Constructor Summary
NameISTreeImpl()
          The default constructor.
NameISTreeImpl(ImmutableName _root_name, boolean _is_hub)
          Constructor.
 
Method Summary
protected  void addAlternate(ImmutableName _node, ImmutableName _alter)
          Adds a node property only for the Alternate relation: mandatory key: node_name; the values are the names of the alternates for the key which is a ground, and (ISFactoryUtilityImpl.IS_ALTERNATE_OF+ground name) for the key which is an alternate.
protected  void addArea(ImmutableName _area, java.lang.String _node_type, java.lang.String[] _l_links)
          Adds an empty area in the nametree, which is defined as a set of nodes in the nametree.
protected  void addChild(ImmutableName _parent, ImmutableName _child, java.lang.String _node_type, boolean _is_hub, java.lang.String[] _l_links)
          Adds a child as a new node in the nametree.
protected  void addMandatoryPath(ImmutableName _node, ImmutableName[] _l_path)
          Adds a mandatory path from a node to access to other nodes.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object _obj)
          Compares the values in the internal maps of this class.
protected  void finalize()
          This method calls finalizeForUser().
protected  void finalizeForUser()
          This method nullifies all the ImmutableNameISTree inner properties.
 java.util.List<ImmutableName> getAlternates(ImmutableName _node)
          Gets the alternates of a node.
 java.lang.String getExtendedVisibleSpace(ImmutableName _node)
          Gets the nodes which are visible for the argument.
 java.lang.String[] getExtendedVisibleSpaceConstants()
          Gets the authorized visible spaces which extends the ImmutableNameTree.isHubNode.
 java.util.List<ImmutableName> getGroundsOfAlternate(ImmutableName _alter)
          Gets the grounds for which the argument is an alternate.
static NameISTreeImpl getInstance()
          The method called from ACSFactoryImplBeanInfo for calling getExtendedVisibleSpaceConstants() to set the ACS visible space.
 java.lang.String[] getLinks(ImmutableName _name)
          Gets the optional links for a name, which depends on the ImmutableNameISTree use.
private  int getMandatoryPathIndex(ImmutableName _node, ImmutableName[] _l_path)
          Tests a path as mandatory path from a node to access to other nodes.
 java.util.List<ImmutableName[]> getMandatoryPaths(ImmutableName _node)
          Gets the mandatory paths from a node or an area to access to other nodes, if rights allow it.
 long getSerialVersionUID()
           
 int hashCode()
           
 boolean isChildOfAcsNode(ImmutableName _node)
          Gets if a node is the direct or indirect child of at least one node having the type ISImpl.ACS_NODE.
 boolean isLinked(ImmutableName _name, java.lang.String _link)
          Tests the presence of a link for a name.
 boolean isMandatoryPath(ImmutableName _node, ImmutableName[] _l_path)
          Tests a path as mandatory path from a node to access to other nodes.
 boolean isOpen(ImmutableName _node)
          Gets the state open/closed of a node or area.
 boolean isParentOfAcsNode(ImmutableName _node)
          Gets if a node is the direct or indirect parent of at least one node having the type ISImpl.ACS_NODE.
protected  void removeAlternate(ImmutableName _node, ImmutableName _alter)
          Removes a node property for the Alternate relation: mandatory key: node_name; the values are the names of the alternates for the key which is a ground, and (ISFactoryUtilityImpl.IS_ALTERNATE_OF+ground name) for the key which is an alternate.
protected  void removeArea(ImmutableName _area)
          Removes an area in the nametree.
protected  void removeLeaf(ImmutableName _node)
          Removes the internal data array for a leaf in the nametree, with an update of the parent, the nametree internal data, but no removing of the node children.
protected  void removeMandatoryPath(ImmutableName _node, ImmutableName[] _l_path)
          Removes a mandatory path from a node.
private  void setAlternates(ImmutableName _node, ImmutableName[] _l_alters)
          Sets the node property for the alternate relation: mandatory key: node_name for a ground ACS or subACS; the values are the names for the key.
protected  void setExtendedVisibleSpace(ImmutableName _node, java.lang.String _space)
          Sets the nodes which are visible for the node argument.
protected  void setLinks(ImmutableName _name, java.lang.String[] _l_links)
          Sets the special links of the name, which depends on the ImmutableNameISTree use.
private  void setMandatoryPaths(ImmutableName _node, ImmutableName[] _l_paths)
          Sets the mandatory paths from a node to access to other nodes.
protected  void setOnlyThisOpen(ImmutableName _node, boolean _open)
          Sets the state open/closed of a node or area, and does not process its parents or children.
protected  void setOpen(ImmutableName _node, boolean _open)
          Sets the state open/closed of a node or area.
 
Methods inherited from class ARoad0.gBase.NameTreeImpl
addArea, addChild, addNodeToArea, getChild, getChildCount, getDepthFirstIndexInNameTree, getIndexInParent, getL_AllChildren, getL_AreaNames, getL_AreasOfNode, getL_DirectChildren, getL_NodesOfArea, getLevel, getM_AreaNodes, getParent, getRoot, getSubTree, getTreePath, getType, isArea, isEmpty, isHubNode, isLeaf, isNode, nbOfLevels, nbOfNodesAndAreas, nodes, removeNodeAndSubTree, removeNodeToArea
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ARoad0.gBaseInterface.ImmutableNameTree
getChild, getChildCount, getDepthFirstIndexInNameTree, getIndexInParent, getL_AllChildren, getL_AreaNames, getL_AreasOfNode, getL_DirectChildren, getL_NodesOfArea, getLevel, getM_AreaNodes, getParent, getRoot, getSubTree, getTreePath, getType, isArea, isEmpty, isHubNode, isLeaf, isNode, nbOfLevels, nbOfNodesAndAreas, nodes
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

m_OpenNodes_

private java.util.Map<ImmutableName,java.lang.Boolean> m_OpenNodes_
ImmutableName/Boolean map of the state open/closed of each node.


m_ExtendedVisibleSpaces_

private java.util.Map<ImmutableName,java.lang.String> m_ExtendedVisibleSpaces_
ImmutableName/String map of visible spaces for a node, which extends the parent children (if ImmutableNameTree.isHubNode is true) and the ImmutableNameTree areas of the node, if any.

It is a mandatory node property:

mandatory key: node_name;

the possible String values are 'xxx_SPACE' ImmutableNameISTree constants.


m_Alternates_

private java.util.Map<ImmutableName,ImmutableName[]> m_Alternates_
Optional node property for the Alternate relation:

mandatory key: node_name for a ground ACS or subACS;

the values are the names of the alternates for the key.


m_MandatoryPaths_

private java.util.Map<ImmutableName,ImmutableName[]> m_MandatoryPaths_
ImmutableName/ImmutableName[] map of the optional mandatory paths

It is an optional node property:

optional key: node_name is the beginning of the first path;

value: the optional array of node names is the mandatory paths to go accross

(if rights allow it),

where the structure is a one-item List, or a List

(first_node, second_node, beginning_node, third_node, fourth_node, beginning_node),

which indicates that there are two paths: from beginning_node to second_node,

and from beginning_node to third_node and fourth_node,

and where all the nodes are in the visible space of the beginning node


m_Links_

private java.util.Map<ImmutableName,java.lang.String[]> m_Links_
ImmutableName/String[] map of optional links which are managed by the user of this class

It is an optional node property with an ImmutableName/String[] map:

the optional key is the node or area name, or the sum of two node names,

the value is an optional String array, where all the properties are also optional and without constraints on the format.


ALL_THE_IS_SPACE

public static final java.lang.String ALL_THE_IS_SPACE
to see all the space

See Also:
Constant Field Values

ONE_STEP_NODES_SPACE

public static final java.lang.String ONE_STEP_NODES_SPACE
to see the parent and the direct children of the node.

See Also:
Constant Field Values

TWO_STEPS_NODES_SPACE

public static final java.lang.String TWO_STEPS_NODES_SPACE
to see the parent and the parent of this parent, the direct children and the direct children of these direct children.

See Also:
Constant Field Values

THREE_STEPS_NODES_SPACE

public static final java.lang.String THREE_STEPS_NODES_SPACE
to see the parent, the first two-levels parents of this parent, the direct children and the first two-levels children of these direct children.

See Also:
Constant Field Values

DIRECT_CHILDREN_SPACE

public static final java.lang.String DIRECT_CHILDREN_SPACE
to see the direct children.

See Also:
Constant Field Values

INDIRECT_CHILDREN_SPACE

public static final java.lang.String INDIRECT_CHILDREN_SPACE
to see the direct and all the indirect children, whatever their levels.

See Also:
Constant Field Values

PARENT_INDIRECT_CHILDREN_SPACE

public static final java.lang.String PARENT_INDIRECT_CHILDREN_SPACE
to see the parent, the direct and all the indirect children, whatever theirs levels.

See Also:
Constant Field Values

PARENT_SPACE

public static final java.lang.String PARENT_SPACE
to see the parent.

See Also:
Constant Field Values

NO_VISIBLE_SPACE

public static final java.lang.String NO_VISIBLE_SPACE
to see nothing; the closed visible space.

See Also:
Constant Field Values

L_VISIBLE_SPACES

private static final java.util.ArrayList<java.lang.String> L_VISIBLE_SPACES
The list of the allowed values for the visible space.


EMPTY_INSTANCE

public static final NameISTreeImpl EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. Caution: never change the state of the returned instance.


serialPersistentFields

public static final java.io.ObjectStreamField[] serialPersistentFields
standardized variables for the serialization

Constructor Detail

NameISTreeImpl

public NameISTreeImpl()
The default constructor.


NameISTreeImpl

public NameISTreeImpl(ImmutableName _root_name,
                      boolean _is_hub)
               throws CreateError
Constructor. The returned instance is empty if _root_name is null or empty. The root visible space is 'ALL_THE_IS_SPACE'. The root type is ISImpl.INFORMATION_SYSTEM_NODE.

Parameters:
_root_name - is the name of the nametree root. Not null.
_is_hub - is true if the root is a node hub
Throws:
CreateError - if _root_name is null or empty
Method Detail

getInstance

public static NameISTreeImpl getInstance()
The method called from ACSFactoryImplBeanInfo for calling getExtendedVisibleSpaceConstants() to set the ACS visible space.

Returns:
an empty instance of this class

isOpen

public boolean isOpen(ImmutableName _node)
Gets the state open/closed of a node or area.

Specified by:
isOpen in interface ImmutableNameISTree
Parameters:
_node - is a node in the ImmutableNameISTree
Returns:
true if the node is opened; always false if it is null or unknown.

setOpen

protected void setOpen(ImmutableName _node,
                       boolean _open)
                throws BaseError
Sets the state open/closed of a node or area. Sets the same state for all its parents if _open is true. Otherwise, sets the same state for the parents which have only this node as still open direct or indirect child. Set the same state for all the children if _open is false, and noop on children otherwise. Calls getTreePath(), getL_DirectChildren() and getL_AllChildren().

Parameters:
_node - is a non-null node or area in the ImmutableNameISTree
_open - true if the node is opened.
Throws:
BaseError - if _node is null, empty or unknown, or thrown by a called method.
See Also:
setOnlyThisOpen(ARoad0.gBaseInterface.ImmutableName, boolean)

setOnlyThisOpen

protected void setOnlyThisOpen(ImmutableName _node,
                               boolean _open)
                        throws BaseError
Sets the state open/closed of a node or area, and does not process its parents or children.

Parameters:
_node - is a non-null node or area in the ImmutableNameISTree
_open - true if the node is opened.
Throws:
BaseError - if _node is null, empty or unknown.
See Also:
setOpen(ARoad0.gBaseInterface.ImmutableName, boolean)

isParentOfAcsNode

public boolean isParentOfAcsNode(ImmutableName _node)
Gets if a node is the direct or indirect parent of at least one node having the type ISImpl.ACS_NODE. The argument may be an area.

Specified by:
isParentOfAcsNode in interface ImmutableNameISTree
Parameters:
_node - is a node or an area in the ImmutableNameISTree
Returns:
true if the argument is a parent

isChildOfAcsNode

public boolean isChildOfAcsNode(ImmutableName _node)
Gets if a node is the direct or indirect child of at least one node having the type ISImpl.ACS_NODE. The argument may be an area.

Specified by:
isChildOfAcsNode in interface ImmutableNameISTree
Parameters:
_node - is a node or an area in the ImmutableNameISTree
Returns:
true if the argument is a child

getExtendedVisibleSpaceConstants

public java.lang.String[] getExtendedVisibleSpaceConstants()
Gets the authorized visible spaces which extends the ImmutableNameTree.isHubNode. Called by SimplePropertyEditor.getRestrictedValues() for ACSFactoryImplBeanInfo.

Specified by:
getExtendedVisibleSpaceConstants in interface ImmutableNameISTree
Returns:
a copy of the authorized visible spaces for the NameISTrees.

getExtendedVisibleSpace

public java.lang.String getExtendedVisibleSpace(ImmutableName _node)
Gets the nodes which are visible for the argument. This extends the native ImmutableNameTree visible space, which is the parent children (if ImmutableNameTree.isHubNode is true) and the ImmutableNameTree areas of the node, if any. The value is one of the constants returned by getExtendedVisibleSpaceConstants(). An area has always ALL_THE_IS_SPACE as visible space.

Specified by:
getExtendedVisibleSpace in interface ImmutableNameISTree
Parameters:
_node - is a node or an area in the ImmutablelNameTree
Returns:
the extended visible space from the node. May be null.

setExtendedVisibleSpace

protected void setExtendedVisibleSpace(ImmutableName _node,
                                       java.lang.String _space)
                                throws BaseError
Sets the nodes which are visible for the node argument. This extends the native ImmutableNameTree visible space, which is the parent children (if ImmutableNameTree.isHubNode is true) and the ImmutableNameTree areas of the node, if any. The value is one of the constants returned by getExtendedVisibleSpaceConstants().

Parameters:
_node - is a non-null node in the ImmutableNameISTree. Never an area.
_space - is the visible space from the node. Never null.
Throws:
BaseError - if _node is null, empty, an area or unknown, if _space is not an authorized value.

addAlternate

protected void addAlternate(ImmutableName _node,
                            ImmutableName _alter)
                     throws BaseError
Adds a node property only for the Alternate relation:

mandatory key: node_name;

the values are the names of the alternates for the key which is a ground, and (ISFactoryUtilityImpl.IS_ALTERNATE_OF+ground name) for the key which is an alternate.

If _node is an ACS, _alter should be also an ACS or an ACS composite ACS. If _node is a subACS, _alter should be also a subACS or a subACS composite.

Parameters:
_node - is a non-null node of an ACS or a subACS
_alter - is an alternate name to add. Never null.
Throws:
BaseError - if an argument is null or is not a nametree node, if the two nodes have not the same type (ACS or subACS), or if the number of alternates for _node is greater than 4.

removeAlternate

protected void removeAlternate(ImmutableName _node,
                               ImmutableName _alter)
                        throws BaseError
Removes a node property for the Alternate relation:

mandatory key: node_name;

the values are the names of the alternates for the key which is a ground, and (ISFactoryUtilityImpl.IS_ALTERNATE_OF+ground name) for the key which is an alternate.

Parameters:
_node - is a non-null node of a ground ACS or subACS
_alter - is an alternate name. Never null.
Throws:
BaseError - if an argument is null or is not a nametree node, or if _alter is not known as an alternate of _node.

getGroundsOfAlternate

public java.util.List<ImmutableName> getGroundsOfAlternate(ImmutableName _alter)
Gets the grounds for which the argument is an alternate.

Specified by:
getGroundsOfAlternate in interface ImmutableNameISTree
Parameters:
_alter - is the node name of an Alternate.
Returns:
the list of grounds for _alter. May be null.

getAlternates

public java.util.List<ImmutableName> getAlternates(ImmutableName _node)
Gets the alternates of a node.

Specified by:
getAlternates in interface ImmutableNameISTree
Parameters:
_node - is a non-null node name of a ground
Returns:
the array of alternates for _node. May be null but not empty.

setAlternates

private void setAlternates(ImmutableName _node,
                           ImmutableName[] _l_alters)
                    throws BaseError
Sets the node property for the alternate relation:

mandatory key: node_name for a ground ACS or subACS;

the values are the names for the key.

Parameters:
_node - is a node with the type ACS or subACS
_l_alters - is the array of alternates to copy. Null to remove _node.
Throws:
BaseError - if _l_alters length is greater than 4

getMandatoryPaths

public java.util.List<ImmutableName[]> getMandatoryPaths(ImmutableName _node)
Gets the mandatory paths from a node or an area to access to other nodes, if rights allow it. The returned value is a list of node name arrays, which are the mandatory paths to go accross. Exemples of the array structure is an one-item List, or a List.

For instance, if the internal mandatory paths array for _node is:

- (first_node, second_node, _node, third_node, fourth_node, _node),

then the first path in the returned list is from _node to second_node,

through first_node, where all the nodes are in the visible space of _node

The use of this property in BaseManagerImpl is to set the unique composite of a subcomposite.

Caution: the returned list may contain a name which is not an area in the nametree. This is because, for a composite subACS relation, if the composite subACS has been removed, the path remains in each subACS to tell 'this is an unworkable subACS'.

Specified by:
getMandatoryPaths in interface ImmutableNameISTree
Parameters:
_node - is a node in the ImmutableNameISTree
Returns:
the list of arrays for mandatory path copies. May be null nut not empty.

isMandatoryPath

public boolean isMandatoryPath(ImmutableName _node,
                               ImmutableName[] _l_path)
Tests a path as mandatory path from a node to access to other nodes. The path is described as an array of node names which are the mandatory paths to go accross. An exemple of the array structure is:

(first_node||second_node||beginning_node||third_node||fourth_node||beginning_node),

which indicates that there are two paths: from beginning_node to second_node,

and from beginning_node to third_node and fourth_node,

and where all the nodes are in the visible space of the beginning node

Call getMandatoryPathIndex().

Specified by:
isMandatoryPath in interface ImmutableNameISTree
Parameters:
_node - is a non-null node in the ImmutableNameISTree
_l_path - is the array of the path to test, without _node. Never null.
Returns:
true if _l_path is a mandatory path of _node

addMandatoryPath

protected void addMandatoryPath(ImmutableName _node,
                                ImmutableName[] _l_path)
                         throws BaseError
Adds a mandatory path from a node to access to other nodes. The path is described as an array of node names which are the mandatory paths to go accross. An exemple of the array structure is:

(first_node||second_node||_node||third_node||fourth_node||_node),

which indicates that there are two mandatory paths: from _node to second_node,

and from _node to third_node and fourth_node,

and where all the nodes are in the visible space of the beginning node

This property is used in BaseManagerImpl to set the unique composite of a subcomposite.

Parameters:
_node - is a non-null node or area in the ImmutableNameISTree
_l_path - is the array of one mandatory path, without _node. Never null.
Throws:
BaseError - if _node is null, empty or unknown, if _l_path has not not the right ImmutableNames structure, if _l_path is null or contains _node, or if its length is greater than 4, if the names are not in the _node visible space.

removeMandatoryPath

protected void removeMandatoryPath(ImmutableName _node,
                                   ImmutableName[] _l_path)
                            throws BaseError
Removes a mandatory path from a node. An exemple of the array structure is:

(first_node||second_node||_node||third_node||fourth_node||_node),

which indicates that there are two paths: from _node to second_node,

and from _node to third_node and fourth_node,

and where all the nodes are in the visible space of the beginning node

Parameters:
_node - is a non-null node or area in the ImmutableNameISTree
_l_path - is the array of one mandatory path, without _node which is the beginning node of the mandatory path. Never null.
Throws:
BaseError - if _node is null, empty or unknown, if _l_path is null, empty, or not a _node mandatory path.

getLinks

public java.lang.String[] getLinks(ImmutableName _name)
Gets the optional links for a name, which depends on the ImmutableNameISTree use. To test if a node is a tied child, uses the instruction Arrays.asList(ISTree.getLinks(nodeName)).contains(ISFactoryUtilityImpl.IS_TIED_CHILD).

Specified by:
getLinks in interface ImmutableNameISTree
Parameters:
_name - is a node/area name or the association of two node/area names in the ImmutableNameISTree
Returns:
the links. May be a 0-length array. Never null.

isLinked

public boolean isLinked(ImmutableName _name,
                        java.lang.String _link)
Tests the presence of a link for a name.

Specified by:
isLinked in interface ImmutableNameISTree
Parameters:
_name - is a node/area name or the association of two node/area names in the ImmutableNameISTree
_link - is a link to test for the name.
Returns:
true if _link is a link of _name

setLinks

protected void setLinks(ImmutableName _name,
                        java.lang.String[] _l_links)
                 throws BaseError
Sets the special links of the name, which depends on the ImmutableNameISTree use. It is an optional node property. There is no control on the _l_links values. Sees this class comments about the use of this method by BaseManager.

Parameters:
_name - is a non-null node/are or the association of two node/area names in the ImmutableNameISTree
_l_links - defines the nature of the links for the name. Null to remove the _name links.
Throws:
BaseError - if _name is null, empty or unknown, _l_links null, or if its length is greater than 12.

addChild

protected void addChild(ImmutableName _parent,
                        ImmutableName _child,
                        java.lang.String _node_type,
                        boolean _is_hub,
                        java.lang.String[] _l_links)
                 throws BaseError
Adds a child as a new node in the nametree. Calls the super method. The default value of the visible space is ALL_THE_IS_SPACE. The resulting node is closed.

Parameters:
_parent - is a node in the nametree. May be null, and then the child is added to the root. Never an area.
_child - is the unique name of the new child of _parent, which is put at the end of the children array
_node_type - is an allowed type for the _parent children, following the ISImpl policy.
_is_hub - is true if the child is a node hub, which means that for this node, any direct child may have exchanges with any other direct child, if the rights allow them.
_l_links - defines the nature of the links for the node. Never null.
Throws:
BaseError - if _parent is not a node of this nametree, if _child is null, is already a nametree node, if the parent does not allow this type for its children, _l_links null, or if its length is greater than 12.

addArea

protected void addArea(ImmutableName _area,
                       java.lang.String _node_type,
                       java.lang.String[] _l_links)
                throws BaseError
Adds an empty area in the nametree, which is defined as a set of nodes in the nametree. These implied nodes may be in any locations.

Areas are used to define virtual structures like a composite ACS which contains several pieces of software running on different servers, and defined in the nametree as nodes.

The area name cannot be a node name, and areas are not explicitly in the nametree. Nevertheless, they are often put graphically under the nametreee node. Areas may be included in areas, but the nametree does not manage this relation. The extended visible space of an area node is always ALL_THE_IS_SPACE. Overrides the NameTreeImpl method.

Parameters:
_area - is the area name.
_node_type - is a value of the type. May be null.
_l_links - defines the nature of the links for the node. Never null.
Throws:
BaseError - if _area is already an area name or a node name.

removeArea

protected void removeArea(ImmutableName _area)
                   throws BaseError
Removes an area in the nametree. Overrides the super method.

Overrides:
removeArea in class NameTreeImpl
Parameters:
_area - is an area name
Throws:
BaseError - if _area is not an area name

removeLeaf

protected void removeLeaf(ImmutableName _node)
                   throws BaseError
Removes the internal data array for a leaf in the nametree, with an update of the parent, the nametree internal data, but no removing of the node children. Caution: any special link where the key contains _node has to be removed by the calling class. The root cannot be removed. Overrides the NameTreeImpl method.

Overrides:
removeLeaf in class NameTreeImpl
Parameters:
_node - is a node of the nametree, not an area.
Throws:
BaseError - if _node is the root, or does not belong to the nametree, or is not a leaf, or if the base is not consistent.

clone

public java.lang.Object clone()
Overrides:
clone in class NameTreeImpl
Returns:
a cloned and no-backed instance of NameISTree, with clone of all names.

equals

public boolean equals(java.lang.Object _obj)
Compares the values in the internal maps of this class.

Specified by:
equals in interface ImmutableNameTree
Overrides:
equals in class NameTreeImpl
Parameters:
_obj - is the object to compare
Returns:
true if the lists of values are equal

hashCode

public int hashCode()
Specified by:
hashCode in interface ImmutableNameTree
Overrides:
hashCode in class NameTreeImpl
Returns:
the hashcode from the super class.

getSerialVersionUID

public long getSerialVersionUID()
Specified by:
getSerialVersionUID in interface ImmutableNameTree
Overrides:
getSerialVersionUID in class NameTreeImpl
Returns:
long serial version UID for serialization of the class

finalizeForUser

protected void finalizeForUser()
This method nullifies all the ImmutableNameISTree inner properties.

Overrides:
finalizeForUser in class NameTreeImpl

finalize

protected void finalize()
                 throws java.lang.Throwable
This method calls finalizeForUser().

Overrides:
finalize in class NameTreeImpl
Throws:
java.lang.Throwable

setMandatoryPaths

private void setMandatoryPaths(ImmutableName _node,
                               ImmutableName[] _l_paths)
                        throws BaseError
Sets the mandatory paths from a node to access to other nodes. These paths may be not active if the proper inter-node rights are not there. The paths are in an array of node names which are the structurally-mandatory paths to go accross (if rights allow it). Exemples of the array structure is:

(first_node, second_node, _node, third_node, fourth_node, _node),

which defines two mandatory paths: from _node to second_node,

and from _node to third_node and fourth_node,

and where all the nodes are in the visible space of the beginning node

The true use of this property is to set the subcomposites of a composite, which is an area, and the unique composite of a subcomposite. So, there is only single-node paths for the moment. For a composite subACS, the subcomposite names are the ACS name ended, as last component, by the subACS name.

Parameters:
_node - is a non-null node in the ImmutableNameISTree
_l_paths - is the array of mandatory paths to copy. Never null.
Throws:
BaseError - if _node is null, empty or unknown, if _l_paths has not not the right ImmutableNames structure, if _l_paths is null or is not ending with _node, or if its length is greater than 20, if the names are not in the _node visible space.

getMandatoryPathIndex

private int getMandatoryPathIndex(ImmutableName _node,
                                  ImmutableName[] _l_path)
Tests a path as mandatory path from a node to access to other nodes. The path is described as an array of node names which are the mandatory paths to go accross. An exemple of the array structure is:

(first_node||second_node||beginning_node||third_node||fourth_node||beginning_node),

which indicates that there are two paths: from beginning_node to second_node,

and from beginning_node to third_node and fourth_node,

and where all the nodes are in the visible space of the beginning node

Called by removeManadatoryPath() and isMandatoryPath().

Parameters:
_node - is a non-null node in the ImmutableNameISTree
_l_path - is the array of the path to test, without _node. Never null.
Returns:
-1 if _l_path is not a mandatory path of _node, or the index of the beginning of _l_path in the _node paths