Package org.anchoranalysis.io.input.path
Class ExtractPathElementRange
Object
ExtractPathElementRange
Extracts a range of elements from a
Path
.- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionstatic Path
extract
(Path path, IndexRangeNegative range) Extracts a sub-path from aPath
by only retaining a range of elements.
-
Method Details
-
extract
Extracts a sub-path from aPath
by only retaining a range of elements.The name-elements are a split of the
Path
by the directory-separator. See thePath
Javadoc.All indices begin at 0 (for the first element), and can also accept negative-indices which count backwards from the end.
e.g. -1 is the last element; -2 is the second-last element.
- Parameters:
path
- the path to find a sub-path for.range
- which elements to include or not.- Returns:
- a newly created
Path
containing only the elements ofpath
in the sub-range. - Throws:
DerivePathException
- if the range contains invalid indices.
-