- Enclosing interface:
MemoryLayoutPREVIEW
PathElement is a preview API of the Java platform.
GroupLayoutPREVIEW. Sequence
path elements are used to select a sequence element layout within a SequenceLayoutPREVIEW; selection
of sequence element layout can be explicit (see sequenceElement(long)) or
implicit (see sequenceElement()). When a path uses one or more implicit
sequence path elements, it acquires additional free dimensions.- Implementation Requirements:
- Implementations of this interface are immutable, thread-safe and value-based.
- Since:
- 19
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionReturns a path element which dereferences an address layout as its target layoutPREVIEW (where set).groupElement(long index) Returns a path element which selects a member layout with the given index in a group layout.groupElement(String name) Returns a path element which selects a member layout with the given name in a group layout.Returns a path element which selects an unspecified element layout in a sequence layout.sequenceElement(long index) Returns a path element which selects the element layout at the specified position in a sequence layout.sequenceElement(long start, long step) Returns a path element which selects the element layout in a range of positions in a sequence layout.
-
Method Details
-
groupElement
Returns a path element which selects a member layout with the given name in a group layout. The path element returned by this method does not alter the number of free dimensions of any path that is combined with such element.- Implementation Requirements:
- in case multiple group elements with a matching name exist, the path element returned by this
method will select the first one; that is, the group element with the lowest offset from current path is selected.
In such cases, using
groupElement(long)might be preferable. - Parameters:
name- the name of the group element to be selected.- Returns:
- a path element which selects the group element with the given name.
-
groupElement
Returns a path element which selects a member layout with the given index in a group layout. The path element returned by this method does not alter the number of free dimensions of any path that is combined with such element.- Parameters:
index- the index of the group element to be selected.- Returns:
- a path element which selects the group element with the given index.
- Throws:
IllegalArgumentException- ifindex < 0.
-
sequenceElement
Returns a path element which selects the element layout at the specified position in a sequence layout. The path element returned by this method does not alter the number of free dimensions of any path that is combined with such element.- Parameters:
index- the index of the sequence element to be selected.- Returns:
- a path element which selects the sequence element layout with the given index.
- Throws:
IllegalArgumentException- ifindex < 0.
-
sequenceElement
Returns a path element which selects the element layout in a range of positions in a sequence layout. The range is expressed as a pair of starting index (inclusive)Sand step factor (which can also be negative)F.If a path with free dimensions
nis combined with the path element returned by this method, the number of free dimensions of the resulting path will be1 + n. If the free dimension associated with this path is bound by an indexI, the resulting accessed offset can be obtained with the following formula:
whereE * (S + I * F)Eis the size (in bytes) of the sequence element layout.Additionally, if
Cis the sequence element count, it follows that0 <= I < B, whereBis computed as follows:- if
F > 0, thenB = ceilDiv(C - S, F) - if
F < 0, thenB = ceilDiv(-(S + 1), -F)
- Parameters:
start- the index of the first sequence element to be selected.step- the step factor at which subsequence sequence elements are to be selected.- Returns:
- a path element which selects the sequence element layout with the given index.
- Throws:
IllegalArgumentException- ifstart < 0, orstep == 0.
- if
-
sequenceElement
Returns a path element which selects an unspecified element layout in a sequence layout.If a path with free dimensions
nis combined with the path element returned by this method, the number of free dimensions of the resulting path will be1 + n. If the free dimension associated with this path is bound by an indexI, the resulting accessed offset can be obtained with the following formula:
whereE * IEis the size (in bytes) of the sequence element layout.Additionally, if
Cis the sequence element count, it follows that0 <= I < C.- Returns:
- a path element which selects an unspecified sequence element layout.
-
dereferenceElement
Returns a path element which dereferences an address layout as its target layoutPREVIEW (where set). The path element returned by this method does not alter the number of free dimensions of any path that is combined with such element. Using this path layout to dereference an address layout that has no target layout results in anIllegalArgumentException(e.g. when a var handle is obtainedPREVIEW).- Returns:
- a path element which dereferences an address layout.
-
PathElementwhen preview features are enabled.