- All Implemented Interfaces:
- Constable,- MemoryLayout
public final class SequenceLayout extends Object
MemoryLayout.ofSequence(3, MemoryLayout.ofValueBits(32, ByteOrder.BIG_ENDIAN));
 
MemoryLayout.ofStruct(
    MemoryLayout.ofValueBits(32, ByteOrder.BIG_ENDIAN),
    MemoryLayout.ofValueBits(32, ByteOrder.BIG_ENDIAN),
    MemoryLayout.ofValueBits(32, ByteOrder.BIG_ENDIAN));
 
 This is a value-based
 class; use of identity-sensitive operations (including reference equality
 (==), identity hash code, or synchronization) on instances of
 SequenceLayout may have unpredictable results and should be avoided.
 The equals method should be used for comparisons.
- Implementation Requirements:
- This class is immutable and thread-safe.
- 
Nested Class SummaryNested classes/interfaces declared in interface jdk.incubator.foreign.MemoryLayoutMemoryLayout.PathElement
- 
Method SummaryModifier and Type Method Description longbitAlignment()Returns the alignment constraint associated with this layout, expressed in bits.longbitSize()Computes the layout size, in bits.Optional<DynamicConstantDesc<SequenceLayout>>describeConstable()OptionalLongelementCount()Returns the element count of this sequence layout (if any).MemoryLayoutelementLayout()Returns the element layout associated with this sequence layout.booleanequals(Object other)Indicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for the object.booleanhasSize()Does this layout have a specified size?Optional<String>name()Return the name (if any) associated with this layout.SequenceLayoutwithBitAlignment(long alignmentBits)Creates a new layout which features the desired alignment constraint.SequenceLayoutwithElementCount(long elementCount)Obtains a new sequence layout with same element layout, alignment constraints and name as this sequence layout but with the new specified element count.SequenceLayoutwithName(String name)Creates a new layout which features the desired layout name.Methods declared in class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods declared in interface jdk.incubator.foreign.MemoryLayoutbyteAlignment, byteSize, map, offset, select, toString, varHandle
- 
Method Details- 
elementLayoutReturns the element layout associated with this sequence layout.- Returns:
- The element layout associated with this sequence layout.
 
- 
elementCountReturns the element count of this sequence layout (if any).- Returns:
- the element count of this sequence layout (if any).
 
- 
withElementCountObtains a new sequence layout with same element layout, alignment constraints and name as this sequence layout but with the new specified element count.- Parameters:
- elementCount- the new element count.
- Returns:
- a new sequence with given element count.
- Throws:
- IllegalArgumentException- if- elementCount < 0.
 
- 
equalsDescription copied from class:ObjectIndicates whether some other object is "equal to" this one.The equalsmethod implements an equivalence relation on non-null object references:- It is reflexive: for any non-null reference value
     x,x.equals(x)should returntrue.
- It is symmetric: for any non-null reference values
     xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue.
- It is transitive: for any non-null reference values
     x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue.
- It is consistent: for any non-null reference values
     xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified.
- For any non-null reference value x,x.equals(null)should returnfalse.
 The equalsmethod for classObjectimplements the most discriminating possible equivalence relation on objects; that is, for any non-null reference valuesxandy, this method returnstrueif and only ifxandyrefer to the same object (x == yhas the valuetrue).Note that it is generally necessary to override the hashCodemethod whenever this method is overridden, so as to maintain the general contract for thehashCodemethod, which states that equal objects must have equal hash codes.- Specified by:
- equalsin interface- MemoryLayout
- Parameters:
- other- the reference object with which to compare.
- Returns:
- trueif this object is the same as the obj argument;- falseotherwise.
- See Also:
- Object.hashCode(),- HashMap
 
- It is reflexive: for any non-null reference value
     
- 
hashCodepublic int hashCode()Description copied from class:ObjectReturns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided byHashMap.The general contract of hashCodeis:- Whenever it is invoked on the same object more than once during
     an execution of a Java application, the hashCodemethod must consistently return the same integer, provided no information used inequalscomparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the equals(Object)method, then calling thehashCodemethod on each of the two objects must produce the same integer result.
- It is not required that if two objects are unequal
     according to the Object.equals(java.lang.Object)method, then calling thehashCodemethod on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
 - Specified by:
- hashCodein interface- MemoryLayout
- Returns:
- a hash code value for this object.
- See Also:
- Object.equals(java.lang.Object),- System.identityHashCode(java.lang.Object)
 
- Whenever it is invoked on the same object more than once during
     an execution of a Java application, the 
- 
describeConstableDescription copied from interface:MemoryLayout
- 
withNameCreates a new layout which features the desired layout name.- Specified by:
- withNamein interface- MemoryLayout
- Parameters:
- name- the layout name.
- Returns:
- a new layout which is the same as this layout, except for the name associated to it.
- See Also:
- MemoryLayout.name()
 
- 
withBitAlignmentCreates a new layout which features the desired alignment constraint.- Specified by:
- withBitAlignmentin interface- MemoryLayout
- Parameters:
- alignmentBits- the layout alignment constraint, expressed in bits.
- Returns:
- a new layout which is the same as this layout, except for the alignment constraint associated to it.
 
- 
nameDescription copied from interface:MemoryLayoutReturn the name (if any) associated with this layout.- Specified by:
- namein interface- MemoryLayout
- Returns:
- the layout name (if any).
- See Also:
- MemoryLayout.withName(String)
 
- 
bitAlignmentpublic final long bitAlignment()Description copied from interface:MemoryLayoutReturns the alignment constraint associated with this layout, expressed in bits. Layout alignment defines a power of twoAwhich is the bit-wise alignment of the layout. IfA <= 8thenA/8is the number of bytes that must be aligned for any pointer that correctly points to this layout. Thus:- A=8means unaligned (in the usual sense), which is common in packets.
- A=64means word aligned (on LP64),- A=32int aligned,- A=16short aligned, etc.
- A=512is the most strict alignment required by the x86/SV ABI (for AVX-512 data).
 MemoryLayout.withBitAlignment(long)), then this method returns the natural alignment constraint (in bits) associated with this layout.- Specified by:
- bitAlignmentin interface- MemoryLayout
- Returns:
- the layout alignment constraint, in bits.
 
- 
hasSizepublic boolean hasSize()Description copied from interface:MemoryLayoutDoes this layout have a specified size? A layout does not have a specified size if it is (or contains) a sequence layout whose size is unspecified (seeelementCount()). Value layouts (seeValueLayout) and padding layouts (seeMemoryLayout.ofPaddingBits(long)) always have a specified size, therefore this method always returnstruein these cases.- Specified by:
- hasSizein interface- MemoryLayout
- Returns:
- true, if this layout has a specified size.
 
- 
bitSizepublic long bitSize()Description copied from interface:MemoryLayoutComputes the layout size, in bits.- Specified by:
- bitSizein interface- MemoryLayout
- Returns:
- the layout size, in bits.
 
 
-