Class HistoricalNodeTree<N extends HistoricalNode>
java.lang.Object
com.inductiveautomation.ignition.common.PathTree<QualifiedPath,N>
com.inductiveautomation.historian.gateway.api.query.HistoricalNodeTree<N>
- Type Parameters:
N- the type of nodes extendingHistoricalNodethat this tree will manage
- All Implemented Interfaces:
Serializable
Represents a specialized tree structure built on top of
PathTree, where nodes are of a type
extending HistoricalNode.
This class provides capability for creating and managing nodes
based on customized paths and allows for recursive removal of nodes along with their parent nodes
if certain conditions are met.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.common.PathTree
PathTree.TreeNode -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbrowse(QualifiedPath path) Essentially an alias for getChildren(path), though wraps the results in a list.final voidclear()Clears the entire tree.final NcomputeIfAbsent(QualifiedPath path, Function<QualifiedPath, N> supplier) protected final PathTree<QualifiedPath,N>.TreeNode findNode(QualifiedPath path, boolean create) Locates the node at the given path.protected final PathTree<QualifiedPath,N>.TreeNode findNode(QualifiedPath path, boolean create, Object[] valueArray) final Nget(QualifiedPath path) Returns the value at the given path.final <R extends N>
Collection<R>Returns all nested children under a given path using breadth-first search.getBranches(QualifiedPath path) Returns the keys for the branches beneath the given point.getBranches(QualifiedPath path, boolean foldersOnly) Returns the keys for the branches beneath the given point.final <R extends N>
Collection<R>getChildren(QualifiedPath path) Returns the children under a given path.protected final @NotNull PathTree<QualifiedPath,N>.TreeNode getRoot()final Object[]getValuesOfPath(QualifiedPath path) Returns all of the node values from the tree nodes along the specified path.protected final PathTree<QualifiedPath,N>.TreeNode instantiateNode(PathTree<QualifiedPath, N>.TreeNode parent, QualifiedPath path, int pos) Instantiates a TreeNode under the parent, for the given path position of the path.final booleanput(QualifiedPath path, N value) Inserts the value at the given path.voidfinal Nremove(QualifiedPath path) Removes the given path, and returns the value that was associated with the path, if applicable.final NremoveIfEmpty(QualifiedPath path) Removes and returns the value, and if there are no children, removes the node from the tree.final intsize()Calculates the size of this tag tree.<E extends Exception>
voidwithReadLock(CheckedRunnable<E> action) <T,E extends Exception>
TwithReadLock(CheckedSupplier<T, E> action) <E extends Exception>
voidwithWriteLock(CheckedRunnable<E> action) <T,E extends Exception>
TwithWriteLock(CheckedSupplier<T, E> action) Methods inherited from class com.inductiveautomation.ignition.common.PathTree
initializeRoot, isCaseSensitive, setCaseSensitive
-
Field Details
-
rwLockExecutor
-
-
Constructor Details
-
HistoricalNodeTree
-
-
Method Details
-
recursiveRemoveWithParent
-
findNode
Description copied from class:PathTreeLocates the node at the given path. Will insert nodes as necessary, if create is true. Otherwise will return null if the path doesn't exist.- Overrides:
findNodein classPathTree<QualifiedPath,N extends HistoricalNode>
-
findNode
protected final PathTree<QualifiedPath,N>.TreeNode findNode(QualifiedPath path, boolean create, Object[] valueArray) - Overrides:
findNodein classPathTree<QualifiedPath,N extends HistoricalNode>
-
getValuesOfPath
Description copied from class:PathTreeReturns all of the node values from the tree nodes along the specified path. The return length will be the path length + 1 (the root/null value), even if the node doesn't exist. Any tree node that doesn't exist or doesn't have a value will have a null entry.- Overrides:
getValuesOfPathin classPathTree<QualifiedPath,N extends HistoricalNode> - Parameters:
path- the path to locate- Returns:
- an array whose bounds are equal to path.getPathLength()+1. Index 0 is the null/root value. Each array element represents the value at a given location in the tree, and will be null if the node does not exist.
-
clear
public final void clear()Description copied from class:PathTreeClears the entire tree.- Overrides:
clearin classPathTree<QualifiedPath,N extends HistoricalNode>
-
removeIfEmpty
Description copied from class:PathTreeRemoves and returns the value, and if there are no children, removes the node from the tree.- Overrides:
removeIfEmptyin classPathTree<QualifiedPath,N extends HistoricalNode>
-
remove
Description copied from class:PathTreeRemoves the given path, and returns the value that was associated with the path, if applicable.- Overrides:
removein classPathTree<QualifiedPath,N extends HistoricalNode>
-
computeIfAbsent
- Overrides:
computeIfAbsentin classPathTree<QualifiedPath,N extends HistoricalNode>
-
get
Description copied from class:PathTreeReturns the value at the given path. If the path is null, the root value is returned.- Overrides:
getin classPathTree<QualifiedPath,N extends HistoricalNode>
-
put
Description copied from class:PathTreeInserts the value at the given path. Returns whether or not the insertion was successful. Intermediary nodes will be created implicitly, and subclasses can customize their values by overriding instantiateNode.- Overrides:
putin classPathTree<QualifiedPath,N extends HistoricalNode>
-
getBranches
Description copied from class:PathTreeReturns the keys for the branches beneath the given point. Returns empty list if the point is not found, or there are no branches. If foldersOnly is true, will only return children that have null leaf values.- Overrides:
getBranchesin classPathTree<QualifiedPath,N extends HistoricalNode>
-
getBranches
Description copied from class:PathTreeReturns the keys for the branches beneath the given point. Returns empty list if the point is not found, or there are no branches.- Overrides:
getBranchesin classPathTree<QualifiedPath,N extends HistoricalNode>
-
getAllNestedChildren
Description copied from class:PathTreeReturns all nested children under a given path using breadth-first search.- Overrides:
getAllNestedChildrenin classPathTree<QualifiedPath,N extends HistoricalNode>
-
getChildren
Description copied from class:PathTreeReturns the children under a given path. Used for browsing. Will never return null, just an empty collection if there are no children or the path doesn't exist. Does not return nested children.- Overrides:
getChildrenin classPathTree<QualifiedPath,N extends HistoricalNode>
-
browse
Description copied from class:PathTreeEssentially an alias for getChildren(path), though wraps the results in a list.- Overrides:
browsein classPathTree<QualifiedPath,N extends HistoricalNode>
-
size
public final int size()Description copied from class:PathTreeCalculates the size of this tag tree. Note that this is not thread safe and is not efficient!- Overrides:
sizein classPathTree<QualifiedPath,N extends HistoricalNode>
-
getRoot
- Overrides:
getRootin classPathTree<QualifiedPath,N extends HistoricalNode>
-
instantiateNode
protected final PathTree<QualifiedPath,N>.TreeNode instantiateNode(PathTree<QualifiedPath, N>.TreeNode parent, QualifiedPath path, int pos) Description copied from class:PathTreeInstantiates a TreeNode under the parent, for the given path position of the path. Subclasses can override this method to provide custom node types, and to create default values for implicit nodes.- Overrides:
instantiateNodein classPathTree<QualifiedPath,N extends HistoricalNode> - Parameters:
parent- the parent nodepath- the complete path of the ultimate node being createdpos- the position in the path that the node is being created for- Returns:
- the new node
-
withReadLock
- Throws:
E extends Exception
-
withReadLock
- Throws:
E extends Exception
-
withWriteLock
- Throws:
E extends Exception
-
withWriteLock
- Throws:
E extends Exception
-