public class Logic extends Number implements IArrayValue<byte[]>, ILogicOperation
Modifier and Type | Field and Description |
---|---|
static byte[] |
char2State
Converts a char to its associated state
|
OPERATOR_AND, OPERATOR_NOT, OPERATOR_OR, OPERATOR_RESOLUITION
ACCURACY_DEFAULT, AT_ANY, AT_ASSOC, AT_ASSOC_DELTA, AT_ASSOC_DELTA_REV, AT_ASSOC_POS, AT_ASSOC_POS_REV, AT_LABEL, AT_MULT, AT_RELATION, CONTENT_CHART, CONTENT_DEFAULT, CONTENT_EVENT, CONTENT_EVENTPARM, CONTENT_GANTT, CONTENT_IMAGE, CONTENT_LABEL, CONTENT_LOG, CONTENT_STATE, CONTENT_TRANSACTION, COUNT_FORMATS, DEFAULT_PLUS_LENGTH, DF_BINARY, DF_ENUM_EVENT, DF_EVENT, DF_FLOAT, DF_INTEGER, DF_LOGIC_16, DF_LOGIC_2, DF_LOGIC_4, DF_NONE, DF_STRUCT, DF_TEXT, ENUM_ASSOC_DOMAINBASE, ENUM_ASSOC_STYLE, ENUM_ASSOC_TARGET, ENUM_GLOBAL, ENUM_LABEL_STYLE, ENUM_MAX, ENUM_MEMBER_0, ENUM_MIN, FLOAT_ACCURACY_32, FLOAT_ACCURACY_64, FLOAT_ACCURACY_BIG, FLOAT_ACCURACY_DEFAULT, FORMAT_ASCII, FORMAT_BINARY, FORMAT_BOOLEAN, FORMAT_COLLECTION_DEFAULT, FORMAT_COLLECTION_KEY_VALUES, FORMAT_COLLECTION_MASK, FORMAT_COLLECTION_MEMBER_0, FORMAT_COLLECTION_MEMBER_1, FORMAT_COLLECTION_MEMBER_2, FORMAT_COLLECTION_MEMBER_3, FORMAT_COLLECTION_VALUES_ONLY, FORMAT_DECIMAL, FORMAT_DECIMAL_F_MAX, FORMAT_DECIMAL_F_MIN, FORMAT_DECIMAL_F0, FORMAT_DECIMAL_F1, FORMAT_DECIMAL_F2, FORMAT_DECIMAL_F3, FORMAT_DECIMAL_F4, FORMAT_DECIMAL_F5, FORMAT_DECIMAL_F6, FORMAT_DECIMAL_F7, FORMAT_DEFAULT, FORMAT_DELTA_DOMAIN, FORMAT_DELTA_VALUE, FORMAT_EVENT, FORMAT_GROUP_INDEX, FORMAT_GROUP_ORDER, FORMAT_HEXADECIMAL, FORMAT_INDEX, FORMAT_MEMBER_0, FORMAT_MEMBER_1, FORMAT_NONE, FORMAT_OCTAL, FORMAT_R4, FORMAT_R5, FORMAT_R6, FORMAT_R7, FORMAT_R8, FORMAT_RELATION_MAX, FORMAT_RELATION_MIN, FORMAT_SIMPLE_MAX, FORMAT_SIMPLE_MIN, FORMAT_SL_TEXT, FORMAT_TEXT, FORMAT_VALUE_DEFAULT, FORMAT_VALUE_MASK, formatCollectionLabels, formatCollectionOptions, formatValueLabels, formatValueOptions, GO_FIRST, GO_INTER, GO_LAST, GO_NONE, GROUP_ORDER_LABELS, INTEGER_ACCURACY_32, INTEGER_ACCURACY_64, INTEGER_ACCURACY_BIG, INTEGER_ACCURACY_DEFAULT, LOGIC_L16_BYTE_FILL, LOGIC_L2_BYTE_FILL, LOGIC_L4_BYTE_FILL, LOGIC_PACK_0, LOGIC_PACK_1, LOGIC_PACK_RIGHT_ALLIGNED, MASK_FORMAT_0_A, MASK_FORMAT_0_AT, MASK_FORMAT_0_DF, MASK_FORMAT_0_GO, MASK_FORMAT_0_N, MASK_FORMAT_0_T, MASK_FORMAT_0_XDF, MASK_FORMAT_1_S0, MASK_FORMAT_1_S0_PLUS, MASK_FORMAT_1_TF, MASK_PLUS, MASK_PLUS_DATA, MAX_DATA, MAX_LAYERS, MAX_SAMPLE_SIZE, MAX_SCALE, SHIFT_FORMAT_0_D, SHIFT_FORMAT_0_DF, SHIFT_FORMAT_0_GO, SHIFT_FORMAT_0_XDF, SHIFT_FORMAT_1_TF, STATE_0_BITS, STATE_1_BITS, STATE_D_BITS, STATE_H_BITS, STATE_J_BITS, STATE_K_BITS, STATE_L_BITS, STATE_LC_DIGITS, STATE_LEVEL_16, STATE_LEVEL_2, STATE_LEVEL_4, STATE_LEVEL_NONE, STATE_M_BITS, STATE_N_BITS, STATE_O_BITS, STATE_P_BITS, STATE_U_BITS, STATE_UC_DIGITS, STATE_UNKNOWN_BITS, STATE_W_BITS, STATE_X_BITS, STATE_Z_BITS, STRUCT_MASK_TYPE, STRUCT_MOD_HIDDEN, STRUCT_MOD_VALID_UNTIL_CHANGE, STRUCT_TYPE_BINARY, STRUCT_TYPE_BOOLEAN, STRUCT_TYPE_ENUM, STRUCT_TYPE_FLOAT, STRUCT_TYPE_INTEGER, STRUCT_TYPE_LOCAL_ENUM, STRUCT_TYPE_MAX, STRUCT_TYPE_MERGE_ENUM, STRUCT_TYPE_STRUCT, STRUCT_TYPE_TEXT, STRUCT_TYPE_UNKNOWN, UF_ABSOLUTE_8, UF_DELTA_0, UF_DELTA_1, UF_DELTA_2, UF_DELTA_4, UF_DELTA_8, UF_DELTA_PREVIOUS, XDF_FLOAT_32, XDF_FLOAT_64, XDF_FLOAT_BIG, XDF_FLOAT_DEFAULT, XDF_INTEGER_32, XDF_INTEGER_64, XDF_INTEGER_BIG, XDF_INTEGER_DEFAULT, XDF_LOGIC_PACK_0, XDF_LOGIC_PACK_1, XDF_LOGIC_PACK_RIGHT_ALLIGNED, XDF_NONE
Constructor and Description |
---|
Logic()
Creates an empty Logic instance.
|
Logic(byte[] states)
Creates a logic vector from the given logic value array.
|
Logic(int bitWidth)
Creates a logic vector with given bit width.
|
Logic(int bitWidth,
byte fill)
Creates a logic vector with given bit width and initial logic value.
|
Logic(int bitWidth,
byte precedingStates,
byte[] states)
Create a new logic vector.
|
Logic(int bitWidth,
byte precedingStates,
String states)
Create a new logic vector.
|
Logic(Logic logic)
Crate a copy of the logic vector.
|
Logic(String states)
Create a new logic vector from a string representation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
booleanValue() |
double |
doubleValue()
Returns the value of the specified number as a
double . |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
static Logic |
expand(int bitWidth,
int format0,
byte[] packed,
int pos,
int length)
Internal method to expand internal representation to a logic value.
|
Logic |
extract(int xbit,
int xlength)
Extract bits.
|
float |
floatValue()
Returns the value of the specified number as a
float . |
byte[] |
getArray() |
int |
getBitWidth()
Returns the bit width.
|
int |
getLevel()
Returns the level.
|
byte |
getState()
Returns the total state.
|
byte |
getState(int index)
Returns the nth state.
|
byte[] |
getStates()
Returns the states as array.
|
void |
getStates(int index,
byte[] states)
Returns the nth state.
|
int |
intValue()
Returns the value of the specified number as an
int . |
Logic |
invert()
Do inversion of the logic value.
|
int |
length() |
long |
longValue()
Returns the value of the specified number as a
long . |
static void |
main(String[] args) |
Logic |
swap()
Swap the bits of the value.
|
Number |
toNumber(boolean signed) |
String |
toString()
Returns a string representation of the object.
|
String |
toString(int format)
Convert to string using the given format.
|
static Logic |
valueOf(boolean bool)
Returns the logic representation of a bool value.
|
static Logic |
valueOf(byte state)
Returns the logic representation of a byte value.
|
static Logic |
valueOf(char state)
Returns the logic representation of a single logic state character.
|
static Logic |
valueOf(double states)
Returns the logic representation of a double value.
|
static Logic |
valueOf(float states)
Returns the logic representation of a float value.
|
static Logic |
valueOf(int states)
Returns the logic representation of an int value.
|
static Logic |
valueOf(long states)
Returns the logic representation of a long value.
|
static Logic |
valueOf(Number states)
Returns the logic representation of a Number value.
|
static Logic |
valueOf(String states)
Returns the logic representation of a String representation.
|
boolean |
write(ILogicSamplesWriter writer,
long units)
Write value into samples writer.
|
boolean |
write(ILogicSamplesWriter writer,
long units,
boolean tag)
Write value into samples writer.
|
byteValue, shortValue
public Logic()
public Logic(int bitWidth)
bitWidth
- public Logic(int bitWidth, byte fill)
bitWidth
- fill
- public Logic(byte[] states)
states
- public Logic(Logic logic)
logic
- public Logic(int bitWidth, byte precedingStates, byte[] states)
bitWidth
- Its bit width.precedingStates
- The leading states, if states length < bitWidth.states
- Its states.public Logic(String states)
states
- public Logic(int bitWidth, byte precedingStates, String states)
bitWidth
- Its bit width.precedingStates
- The leading states, if states length < bitWidth.states
- Its states.public static Logic valueOf(boolean bool)
bool
- public static Logic valueOf(byte state)
states
- public static Logic valueOf(char state)
state
- public static Logic valueOf(String states)
states
- public static Logic valueOf(long states)
states
- public static Logic valueOf(int states)
states
- public static Logic valueOf(float states)
states
- public static Logic valueOf(double states)
states
- public static Logic valueOf(Number states)
states
- public static Logic expand(int bitWidth, int format0, byte[] packed, int pos, int length)
bitWidth
- format0
- packed
- pos
- length
- public byte[] getArray()
getArray
in interface IArrayValue<byte[]>
public int length()
length
in interface IArrayValue<byte[]>
public byte[] getStates()
public int getBitWidth()
public byte getState(int index)
index
- public void getStates(int index, byte[] states)
index
- public byte getState()
public int getLevel()
public boolean write(ILogicSamplesWriter writer, long units)
writer
- units
- public boolean write(ILogicSamplesWriter writer, long units, boolean tag)
writer
- units
- tag
- public int intValue()
Number
int
.
This may involve rounding or truncation.public long longValue()
Number
long
.
This may involve rounding or truncation.public float floatValue()
Number
float
.
This may involve rounding.floatValue
in class Number
float
.public double doubleValue()
Number
double
.
This may involve rounding.doubleValue
in class Number
double
.public boolean booleanValue()
public String toString(int format)
format
- public Number toNumber(boolean signed)
public Logic extract(int xbit, int xlength)
xbit
- Starting bit.xlength
- The number of bits to be extracted.public Logic invert()
public Logic swap()
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public boolean equals(Object obj)
Object
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
equals
in class Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public static void main(String[] args)