Package org.apache.sis.metadata
Class TreeNode.CollectionElement
java.lang.Object
org.apache.sis.metadata.TreeNode
org.apache.sis.metadata.TreeNode.Element
org.apache.sis.metadata.TreeNode.CollectionElement
- All Implemented Interfaces:
TreeTable.Node
- Enclosing class:
- TreeNode
A node for an element in a collection. This class needs the iteration order to be stable.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.metadata.TreeNode
TreeNode.CollectionElement, TreeNode.Element -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final intIndex of the element in the collection, in iteration order.Fields inherited from class org.apache.sis.metadata.TreeNode.Element
decoratorFields inherited from class org.apache.sis.metadata.TreeNode
baseType, cachedValue, metadata, table -
Constructor Summary
ConstructorsConstructorDescriptionCollectionElement(TreeNode parent, Object metadata, PropertyAccessor accessor, int indexInData, int indexInList) Creates a new node for the given collection element. -
Method Summary
Modifier and TypeMethodDescription(package private) voidappendIdentifier(StringBuilder buffer) Appends an identifier for this node in the given buffer, forTreeNode.toString()implementation.booleanReturnstrueif the value returned bygetUserObject()should be the same for both nodes.(package private) IntegergetIndex()Returns the zero-based index of this node in the metadata property.(package private) CharSequencegetName()Appends the index of this property, if there is more than one.Fetches the property value from the metadata object, which is expected to be a collection, then fetch the element at the index represented by this node.inthashCode()Returns a hash code value for this node.(package private) voidsetUserObject(Object value) Sets the property value for this node.Methods inherited from class org.apache.sis.metadata.TreeNode.Element
getIdentifier, getRemarks, isWritableMethods inherited from class org.apache.sis.metadata.TreeNode
appendStringTo, getChildren, getParent, getValue, isEditable, isLeaf, isMetadata, newChild, setValue, toString
-
Field Details
-
indexInList
final int indexInListIndex of the element in the collection, in iteration order.
-
-
Constructor Details
-
CollectionElement
CollectionElement(TreeNode parent, Object metadata, PropertyAccessor accessor, int indexInData, int indexInList) Creates a new node for the given collection element.- Parameters:
parent- the parent of this node.metadata- the metadata object for which this node will be a value.accessor- accessor to use for fetching the name, type and collection.indexInData- index to be given to the accessor of fetching the collection.indexInList- index of the element in the collection, in iteration order.
-
-
Method Details
-
appendIdentifier
Appends an identifier for this node in the given buffer, forTreeNode.toString()implementation.- Overrides:
appendIdentifierin classTreeNode.Element
-
getIndex
Integer getIndex()Returns the zero-based index of this node in the metadata property. -
getName
CharSequence getName()Appends the index of this property, if there is more than one. Index numbering begins at 1, since this name if for human reading.- Overrides:
getNamein classTreeNode.Element
-
getUserObject
Fetches the property value from the metadata object, which is expected to be a collection, then fetch the element at the index represented by this node.- Specified by:
getUserObjectin interfaceTreeTable.Node- Overrides:
getUserObjectin classTreeNode.Element- Returns:
- any object stored at this node by the user, or
nullif none.
-
setUserObject
Sets the property value for this node.- Overrides:
setUserObjectin classTreeNode.Element
-
equals
Returnstrueif the value returned bygetUserObject()should be the same for both nodes.- Specified by:
equalsin interfaceTreeTable.Node- Overrides:
equalsin classTreeNode.Element- Parameters:
other- the other object to compare with this node.- Returns:
- whether the two objects are nodes with equal values and equal children, ignoring parents.
-
hashCode
public int hashCode()Returns a hash code value for this node.- Specified by:
hashCodein interfaceTreeTable.Node- Overrides:
hashCodein classTreeNode.Element- Returns:
- a hash code for this node, potentially based on values and children but ignoring parent.
-