
dds.deal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dds4j Show documentation
Show all versions of dds4j Show documentation
Wrapper around the Double Dummy Solver C++ Library.
The newest version!
// Generated by jextract
package dds;
import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;
/**
* {@snippet lang=c :
* struct deal {
* int trump;
* int first;
* int currentTrickSuit[3];
* int currentTrickRank[3];
* unsigned int remainCards[4][4];
* }
* }
*/
public class deal {
deal() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
Dds.C_INT.withName("trump"),
Dds.C_INT.withName("first"),
MemoryLayout.sequenceLayout(3, Dds.C_INT).withName("currentTrickSuit"),
MemoryLayout.sequenceLayout(3, Dds.C_INT).withName("currentTrickRank"),
MemoryLayout.sequenceLayout(4, MemoryLayout.sequenceLayout(4, Dds.C_INT)).withName("remainCards")
).withName("deal");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt trump$LAYOUT = (OfInt)$LAYOUT.select(groupElement("trump"));
/**
* Layout for field:
* {@snippet lang=c :
* int trump
* }
*/
public static final OfInt trump$layout() {
return trump$LAYOUT;
}
private static final long trump$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* int trump
* }
*/
public static final long trump$offset() {
return trump$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int trump
* }
*/
public static int trump(MemorySegment struct) {
return struct.get(trump$LAYOUT, trump$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int trump
* }
*/
public static void trump(MemorySegment struct, int fieldValue) {
struct.set(trump$LAYOUT, trump$OFFSET, fieldValue);
}
private static final OfInt first$LAYOUT = (OfInt)$LAYOUT.select(groupElement("first"));
/**
* Layout for field:
* {@snippet lang=c :
* int first
* }
*/
public static final OfInt first$layout() {
return first$LAYOUT;
}
private static final long first$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* int first
* }
*/
public static final long first$offset() {
return first$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int first
* }
*/
public static int first(MemorySegment struct) {
return struct.get(first$LAYOUT, first$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int first
* }
*/
public static void first(MemorySegment struct, int fieldValue) {
struct.set(first$LAYOUT, first$OFFSET, fieldValue);
}
private static final SequenceLayout currentTrickSuit$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("currentTrickSuit"));
/**
* Layout for field:
* {@snippet lang=c :
* int currentTrickSuit[3]
* }
*/
public static final SequenceLayout currentTrickSuit$layout() {
return currentTrickSuit$LAYOUT;
}
private static final long currentTrickSuit$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* int currentTrickSuit[3]
* }
*/
public static final long currentTrickSuit$offset() {
return currentTrickSuit$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int currentTrickSuit[3]
* }
*/
public static MemorySegment currentTrickSuit(MemorySegment struct) {
return struct.asSlice(currentTrickSuit$OFFSET, currentTrickSuit$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* int currentTrickSuit[3]
* }
*/
public static void currentTrickSuit(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, currentTrickSuit$OFFSET, currentTrickSuit$LAYOUT.byteSize());
}
private static long[] currentTrickSuit$DIMS = { 3 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* int currentTrickSuit[3]
* }
*/
public static long[] currentTrickSuit$dimensions() {
return currentTrickSuit$DIMS;
}
private static final VarHandle currentTrickSuit$ELEM_HANDLE = currentTrickSuit$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* int currentTrickSuit[3]
* }
*/
public static int currentTrickSuit(MemorySegment struct, long index0) {
return (int)currentTrickSuit$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* int currentTrickSuit[3]
* }
*/
public static void currentTrickSuit(MemorySegment struct, long index0, int fieldValue) {
currentTrickSuit$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final SequenceLayout currentTrickRank$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("currentTrickRank"));
/**
* Layout for field:
* {@snippet lang=c :
* int currentTrickRank[3]
* }
*/
public static final SequenceLayout currentTrickRank$layout() {
return currentTrickRank$LAYOUT;
}
private static final long currentTrickRank$OFFSET = 20;
/**
* Offset for field:
* {@snippet lang=c :
* int currentTrickRank[3]
* }
*/
public static final long currentTrickRank$offset() {
return currentTrickRank$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int currentTrickRank[3]
* }
*/
public static MemorySegment currentTrickRank(MemorySegment struct) {
return struct.asSlice(currentTrickRank$OFFSET, currentTrickRank$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* int currentTrickRank[3]
* }
*/
public static void currentTrickRank(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, currentTrickRank$OFFSET, currentTrickRank$LAYOUT.byteSize());
}
private static long[] currentTrickRank$DIMS = { 3 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* int currentTrickRank[3]
* }
*/
public static long[] currentTrickRank$dimensions() {
return currentTrickRank$DIMS;
}
private static final VarHandle currentTrickRank$ELEM_HANDLE = currentTrickRank$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* int currentTrickRank[3]
* }
*/
public static int currentTrickRank(MemorySegment struct, long index0) {
return (int)currentTrickRank$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* int currentTrickRank[3]
* }
*/
public static void currentTrickRank(MemorySegment struct, long index0, int fieldValue) {
currentTrickRank$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final SequenceLayout remainCards$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("remainCards"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int remainCards[4][4]
* }
*/
public static final SequenceLayout remainCards$layout() {
return remainCards$LAYOUT;
}
private static final long remainCards$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int remainCards[4][4]
* }
*/
public static final long remainCards$offset() {
return remainCards$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int remainCards[4][4]
* }
*/
public static MemorySegment remainCards(MemorySegment struct) {
return struct.asSlice(remainCards$OFFSET, remainCards$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int remainCards[4][4]
* }
*/
public static void remainCards(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, remainCards$OFFSET, remainCards$LAYOUT.byteSize());
}
private static long[] remainCards$DIMS = { 4, 4 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* unsigned int remainCards[4][4]
* }
*/
public static long[] remainCards$dimensions() {
return remainCards$DIMS;
}
private static final VarHandle remainCards$ELEM_HANDLE = remainCards$LAYOUT.varHandle(sequenceElement(), sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* unsigned int remainCards[4][4]
* }
*/
public static int remainCards(MemorySegment struct, long index0, long index1) {
return (int)remainCards$ELEM_HANDLE.get(struct, 0L, index0, index1);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* unsigned int remainCards[4][4]
* }
*/
public static void remainCards(MemorySegment struct, long index0, long index1, int fieldValue) {
remainCards$ELEM_HANDLE.set(struct, 0L, index0, index1, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy