Package cz.diribet.aqdef.model
Class AqdefHierarchy
- java.lang.Object
-
- cz.diribet.aqdef.model.AqdefHierarchy
-
public class AqdefHierarchy extends Object
Contains information about hierarchy of parts / characteristics / groups. There are two types of hiearchy definition within the AQDEF structure:- reagular hiearchy stored in
K51xxkeys - simplified characteristics hierarchy stored in
K2030/K2031keys
The simplified characteristics hierarchy
The simplified characteristics hierarchy from
K2030/K2031keys is internally transformed to theK51xxstructure. In other words, there is no way to get information about simple hierarchy back from the hierarchy model.Note that hierarchy model created from a simplified characteristics hierarchy needs to be
normalized, because there could be characteristics without binding to a root part node, or there could be no root part node at all.- Author:
- Vlastimil Dolejs, Honza Krakora
- See Also:
normalize(AqdefObjectModel)
- reagular hiearchy stored in
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAqdefHierarchy.HierarchyEntry
-
Constructor Summary
Constructors Constructor Description AqdefHierarchy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforEachNodeBinding(Consumer<AqdefHierarchy.HierarchyEntry> action)voidforEachNodeDefinition(Consumer<AqdefHierarchy.HierarchyEntry> action)Optional<Object>getParentIndex(CharacteristicIndex characteristicIndex)Find index of parent characteristic or group of given characteristic.Optional<Object>getParentIndex(GroupIndex groupIndex)Find index of parent characteristic or group of given group.booleanhasChildren(CharacteristicIndex characteristicIndex)booleanisEmpty()AqdefHierarchynormalize(AqdefObjectModel aqdefObjectModel)Get the normalized hierarchy.voidputEntry(KKey kKey, Integer index, Object value)voidputEntry(AqdefHierarchy.HierarchyEntry entry)voidremoveHierarchyForCharacteristic(CharacteristicIndex index)Removes node definition and all subnode definitions as well as node bindings for the provided characteristic.voidremoveHierarchyForGroup(GroupIndex index)Removes node definition and all subnode definitions as well as node bindings for the provided group.voidremoveHierarchyForPart(PartIndex index)Removes node definition and all subnode definitions as well as node bindings for the provided part.
-
-
-
Method Detail
-
putEntry
public void putEntry(AqdefHierarchy.HierarchyEntry entry)
-
removeHierarchyForPart
public void removeHierarchyForPart(PartIndex index)
Removes node definition and all subnode definitions as well as node bindings for the provided part.- Parameters:
index- index of the part to remove hierarchy for
-
removeHierarchyForCharacteristic
public void removeHierarchyForCharacteristic(CharacteristicIndex index)
Removes node definition and all subnode definitions as well as node bindings for the provided characteristic.- Parameters:
index- index of the characteristic to remove hierarchy for
-
removeHierarchyForGroup
public void removeHierarchyForGroup(GroupIndex index)
Removes node definition and all subnode definitions as well as node bindings for the provided group.- Parameters:
index- index of the group to remove hierarchy for
-
normalize
public AqdefHierarchy normalize(AqdefObjectModel aqdefObjectModel)
Get the normalized hierarchy.- Parameters:
aqdefObjectModel- an aqdef model containing this hierarchy, must not benull- Returns:
- normalized hierarchy, the source hierarchy is not changed
-
forEachNodeDefinition
public void forEachNodeDefinition(Consumer<AqdefHierarchy.HierarchyEntry> action)
-
forEachNodeBinding
public void forEachNodeBinding(Consumer<AqdefHierarchy.HierarchyEntry> action)
-
isEmpty
public boolean isEmpty()
-
hasChildren
public boolean hasChildren(CharacteristicIndex characteristicIndex)
-
getParentIndex
public Optional<Object> getParentIndex(CharacteristicIndex characteristicIndex)
Find index of parent characteristic or group of given characteristic.- Parameters:
characteristicIndex-- Returns:
- optional containing
CharacteristicIndexorGroupIndexof parent, or empty optional if given characteristic do not have a parent
-
getParentIndex
public Optional<Object> getParentIndex(GroupIndex groupIndex)
Find index of parent characteristic or group of given group.- Parameters:
groupIndex-- Returns:
- optional containing
CharacteristicIndexorGroupIndexof parent, or empty optional if given group do not have a parent
-
-