public class Device extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PEEKS
Default number of bits to reveal per peek.
|
static int |
DEFAULT_SIZE
Default number of bits stored.
|
static char |
VALUE_FALSE
Character indicator of false.
|
static char |
VALUE_TRUE
Character indicator of true.
|
| Constructor and Description |
|---|
Device()
Construct device using defaults.
|
Device(boolean[] initialBits,
int bitsPerPeek)
Construct device with specified bits for testing.
|
Device(int size,
int bitsPerPeek)
Construct device with specified size and
number of peek/poke bits.
|
| Modifier and Type | Method and Description |
|---|---|
CharSequence |
peek(CharSequence pattern)
Peek at bits of device.
|
void |
poke(CharSequence pattern)
Poke bits into device.
|
boolean |
spin()
Initiate device rotation.
|
String |
toString()
Render device information as a string.
|
public static final int DEFAULT_SIZE
public static final int DEFAULT_PEEKS
public static final char VALUE_TRUE
public static final char VALUE_FALSE
public Device()
public Device(int size,
int bitsPerPeek)
size - the number of bits stored in this devicebitsPerPeek - the number of bits to
disclose via peek or set via pokepublic Device(boolean[] initialBits,
int bitsPerPeek)
initialBits - the bit values for this test devicebitsPerPeek - the number of bits to
disclose via peek or set via pokepublic boolean spin()
public CharSequence peek(CharSequence pattern)
pattern - indicates which bits to reveal as '?'.
pattern.length() must be
exactly equal to the number of bits stored in the device.public void poke(CharSequence pattern)
pattern - indicator of values of bits to poke.
pattern.length() must be
exactly equal to the number of bits stored in the device.
Values of 'T' or 'F' that correspond to '?' in the
preceding peek request pattern
replace the values in the device.