- java.lang.Object
-
- com.tigerbeetle.Batch
-
- com.tigerbeetle.AccountBatch
-
public final class AccountBatch extends Batch
-
-
Constructor Summary
Constructors Constructor Description AccountBatch(int capacity)
Creates an empty batch with the desired maximum capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCode()
long
getCreditsPending()
long
getCreditsPosted()
long
getDebitsPending()
long
getDebitsPosted()
int
getFlags()
byte[]
getId()
long
getId(UInt128 part)
int
getLedger()
long
getTimestamp()
byte[]
getUserData()
long
getUserData(UInt128 part)
void
setCode(int code)
void
setFlags(int flags)
void
setId(byte[] id)
void
setId(long leastSignificant)
void
setId(long leastSignificant, long mostSignificant)
void
setLedger(int ledger)
void
setUserData(byte[] userData)
void
setUserData(long leastSignificant)
void
setUserData(long leastSignificant, long mostSignificant)
-
Methods inherited from class com.tigerbeetle.Batch
add, at, beforeFirst, getArray, getCapacity, getLength, getPosition, getUInt128, getUInt128, getUInt16, getUInt32, getUInt64, isReadOnly, isValidPosition, next, putArray, putUInt128, putUInt128, putUInt16, putUInt32, putUInt64, setPosition
-
-
-
-
Constructor Detail
-
AccountBatch
public AccountBatch(int capacity)
Creates an empty batch with the desired maximum capacity.Once created, an instance cannot be resized, however it may contain any number of elements between zero and its
capacity
.- Parameters:
capacity
- the maximum capacity.- Throws:
IllegalArgumentException
- if capacity is negative.
-
-
Method Detail
-
getId
public byte[] getId()
- Returns:
- an array of 16 bytes representing the 128-bit value.
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- id
-
getId
public long getId(UInt128 part)
- Parameters:
part
- aUInt128
enum indicating which part of the 128-bit value is to be retrieved.- Returns:
- a
long
representing the first 8 bytes of the 128-bit value ifUInt128.LeastSignificant
is informed, or the last 8 bytes ifUInt128.MostSignificant
. - Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- id
-
setId
public void setId(byte[] id)
- Parameters:
id
- an array of 16 bytes representing the 128-bit value.- Throws:
IllegalArgumentException
- ifid
is not 16 bytes long.IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- id
-
setId
public void setId(long leastSignificant, long mostSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.mostSignificant
- along
representing the last 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- id
-
setId
public void setId(long leastSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- id
-
getUserData
public byte[] getUserData()
- Returns:
- an array of 16 bytes representing the 128-bit value.
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- user_data
-
getUserData
public long getUserData(UInt128 part)
- Parameters:
part
- aUInt128
enum indicating which part of the 128-bit value is to be retrieved.- Returns:
- a
long
representing the first 8 bytes of the 128-bit value ifUInt128.LeastSignificant
is informed, or the last 8 bytes ifUInt128.MostSignificant
. - Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- user_data
-
setUserData
public void setUserData(byte[] userData)
- Parameters:
userData
- an array of 16 bytes representing the 128-bit value.- Throws:
IllegalArgumentException
- ifuserData
is not 16 bytes long.IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- user_data
-
setUserData
public void setUserData(long leastSignificant, long mostSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.mostSignificant
- along
representing the last 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- user_data
-
setUserData
public void setUserData(long leastSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- user_data
-
getLedger
public int getLedger()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- ledger
-
setLedger
public void setLedger(int ledger)
- Parameters:
ledger
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- ledger
-
getCode
public int getCode()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- code
-
setCode
public void setCode(int code)
- Parameters:
code
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- code
-
getFlags
public int getFlags()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- flags
-
setFlags
public void setFlags(int flags)
- Parameters:
flags
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- flags
-
getDebitsPending
public long getDebitsPending()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- debits_pending
-
getDebitsPosted
public long getDebitsPosted()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- debits_posted
-
getCreditsPending
public long getCreditsPending()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- credits_pending
-
getCreditsPosted
public long getCreditsPosted()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- credits_posted
-
getTimestamp
public long getTimestamp()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- timestamp
-
-