|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.util.Serializable_array
ds.ov2.bignat.Bignat_array
public class Bignat_array
APDU_Serializable
interface around an array of Bignats
.
This is used inside Vector
to factor out the bignat array
functionality. This implementation uses simply an bignat array
internally. Other implementations relying on a huge byte array
seem possible.
Although this is a card data type,
Serializable_array.is_compatible_with()
is not overridden here.
This is left for clients extending this class.
The size of the array is determined by the length
argument
of the constructor. The size stays constant for the lifetime of the
object. However, the array can provide the illusion of a different
(smaller) length. This functionality is thought for testing
purposes and only available if the cpp symbol VARIABLE_SIZE_BIGNATS
is defined, see field length
and method set_length(short)
.
For a number of general topics see also the package description.
Field Summary | |
---|---|
private Bignat[] |
a
The array of the contained bignats. |
protected short |
length
Length of the array a . |
Constructor Summary | |
---|---|
Bignat_array(short length)
Nonallocating constructor. |
|
Bignat_array(short bignat_size,
short length,
boolean in_ram)
Allocating constructor. |
Method Summary | |
---|---|
void |
allocate(short bignat_size,
boolean in_ram)
Allocate fresh bignats for the whole array. |
void |
copy_digit(short digit,
byte[] buf)
Copy digit. |
protected APDU_Serializable[] |
get_array()
Return the bignat array a in support for abstract
Serializable_array . |
short |
get_bignat_length()
Digit length of the contained bignats in bytes. |
short |
get_bignat_size()
Size of the contained bignats in bytes. |
short |
get_length()
Return length as effective size in support for abstract
Serializable_array . |
Bignat |
get(short i)
Return element i . |
void |
register_long_bignats()
Register the array contents as long resizable bignats. |
void |
register_short_bignats()
Register the array contents as short resizable bignats. |
void |
set_length(short new_length)
Virtual length change. |
void |
set(short i,
Bignat b)
Set element i . |
short |
size()
Size in bytes necessary to send or receive this object via the OV-chip protocol layer, see APDU_Serializable.size() . |
Methods inherited from class ds.ov2.util.Serializable_array |
---|
from_byte_array, is_compatible_with, to_byte_array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ds.ov2.util.APDU_Serializable |
---|
from_byte_array, is_compatible_with, to_byte_array |
Field Detail |
---|
private Bignat[] a
protected short length
a
. Final unless
VARIABLE_SIZE_BIGNATS is defined. Can be changed via
set_length
to provide the illusion of
a shorter array.
Constructor Detail |
---|
public Bignat_array(short length)
set
. Useful if some of the bignats that
are going to populate this array are already allocated.
ASSERT's
that length
is at least 1. Bignat arrays of length zero
are almost useless, because get_bignat_size()
and get_bignat_length()
access the element at index 0.
length
- length of the array (maximal length if
VARIABLE_SIZE_BIGNATS is defined and set_length
is available).public Bignat_array(short bignat_size, short length, boolean in_ram)
ASSERT's
that length
is at least 1. Bignat arrays of length zero
are almost useless, because get_bignat_size()
and get_bignat_length()
access the element at index 0.
bignat_size
- size of the bignats in the arraylength
- length of the arrayin_ram
- if true, allocate the digit array of theMethod Detail |
---|
public void set_length(short new_length)
length
field to provide
the illusion of a different array size.
Asserts that new_length
is shorter than the real
length of a
.
Only available if VARIABLE_SIZE_BIGNATS is defined.
new_length
- new lengthpublic void allocate(short bignat_size, boolean in_ram)
bignat_size
- size of the bignatsin_ram
- if true, allocate the digit array of the
bignats in transient memory (RAM) on the card.public void register_short_bignats()
Resize
.
Only available if VARIABLE_SIZE_BIGNATS is defined.
public void register_long_bignats()
Resize
.
Only available if VARIABLE_SIZE_BIGNATS is defined.
public short get_bignat_size()
a[0].
size()
.
public short get_bignat_length()
a[0].
length()
.
public Bignat get(short i)
i
.
i
- index
i
ArrayIndexOutOfBoundsException
- if i
is out of boundspublic void set(short i, Bignat b)
i
.
i
- indexb
- bignat to store at index i
ArrayIndexOutOfBoundsException
- if i
is out of boundspublic void copy_digit(short digit, byte[] buf)
digit
of all bignats in the
array into buf
such that buf[0]
contains the
digit of get
(0)
, buf[1]
of
get
(1)
, and so on.
buf
is an array of type DIGIT_TYPE.
Asserts that buf
is at least of size length
and that digit
is less than the size of the bignats in
this array.
Used in exponentiation in
Vector.exponent_mod
digit
- digit number to copybuf
- of type DIGIT_TYPE[]
, result array of digitsprotected APDU_Serializable[] get_array()
a
in support for abstract
Serializable_array
.
get_array
in class Serializable_array
public short get_length()
length
as effective size in support for abstract
Serializable_array
.
get_length
in class Serializable_array
length
public short size()
APDU_Serializable.size()
.
size
in interface APDU_Serializable
size
in class Serializable_array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |