Package de.linusdev.lutils.struct.info
Class StructureInfo
java.lang.Object
de.linusdev.lutils.struct.info.StructureInfo
- All Implemented Interfaces:
MemorySizeable
- Direct Known Subclasses:
ArrayStructureInfo,BBMatrixInfo,BBVectorInfo,ComplexStructureInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final booleanprotected final intprotected final int @NotNull []array of item sizes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStructureInfo(int alignment, boolean compressed, int size, int @NotNull [] sizes) StructureInfo(int alignment, boolean compressed, int prePadding, int size, int postPadding) Manually createStructureInfo. -
Method Summary
Modifier and TypeMethodDescriptionintThe recommended alignment of this object in memory.intRequired size including padding.int @NotNull []getSizes()booleanWhether thisStructureInfois compressed.
-
Field Details
-
alignment
protected final int alignment -
compressed
protected final boolean compressed -
size
protected final int size -
sizes
protected final int @NotNull [] sizesarray of item sizes. Always alternating between padding and item. First and last element are always a padding.
Layout:
[0]: pad, [1]: size, [2]: pad, [3]: size, [4]: pad, [5]: size, ...
-
-
Constructor Details
-
StructureInfo
public StructureInfo(int alignment, boolean compressed, int prePadding, int size, int postPadding) Manually createStructureInfo.- Parameters:
alignment- alignment of the structurecompressed- whether the structure is compressed, seeisCompressed()prePadding- padding before theStructuresize- size of the actualStructure(without any padding)postPadding- padding after theStructure
-
StructureInfo
protected StructureInfo(int alignment, boolean compressed, int size, int @NotNull [] sizes)
-
-
Method Details
-
getRequiredSize
public int getRequiredSize()Description copied from interface:MemorySizeableRequired size including padding.- Specified by:
getRequiredSizein interfaceMemorySizeable- Returns:
- the size required by this object in memory
-
getAlignment
public int getAlignment()Description copied from interface:MemorySizeableThe recommended alignment of this object in memory. Either1, 2, 4, 8or16.- Specified by:
getAlignmentin interfaceMemorySizeable- Returns:
- recommended alignment
-
isCompressed
public boolean isCompressed()Whether thisStructureInfois compressed. Compressed means, it should ignore the size of the individual elements when aligning the structure.- Returns:
trueif it is compressed.
-
getSizes
public int @NotNull [] getSizes()
-