public class ControlUnitInfo
extends java.lang.Object
ControlUnitInfo could be in one of the three modes:
ID, CHECKSUM or STATE. Optionally it may bear info about
its parent control units.| Modifier and Type | Field and Description |
|---|---|
protected int |
checksum
Checksum for this control unit's state.
|
static int |
CHECKSUM
When
ControlUnitInfo is in SCHECKSUM |
protected boolean |
hasParentsInfo
Flag indicating whether this object bears parent info.
|
protected java.lang.String |
id
Id of this control unit.
|
static int |
ID
When
ControlUnitInfo is in ID |
protected int |
mode
Mode of this
ControlUnitInfo. |
static java.lang.String |
NULL_VALUE |
protected ControlUnitInfo[] |
parents
List of control units.
|
protected java.util.Dictionary |
state
The control unit's state.
|
static int |
STATE
When
ControlUnitInfo is in STATE |
protected java.lang.String |
type
Type of this control unit.
|
| Constructor and Description |
|---|
ControlUnitInfo() |
| Modifier and Type | Method and Description |
|---|---|
static int |
calcCheckSum(ControlUnitInfo cuInfo)
Calculates the checksum of given
ControlUnitInfo object in STATE mode. |
static int |
calcCheckSum(java.lang.String[] stateInterface,
java.lang.Object[] values)
Calculates the checksum of control unit state.
|
int |
getCheckSum()
Returns the checksum for this control unit's state.
|
java.lang.String |
getId()
Returns the id of this control unit.
|
int |
getMode()
Returns the mode of this
ControlUnitInfo. |
ControlUnitInfo[] |
getParentsInfo()
Returns parent info - list of control units that are parents of this control unit.
|
java.lang.String[] |
getStateInterface()
Returns the list of ids of state variables held in this
ControlunitInfo object. |
java.util.Dictionary |
getStateVaraibles()
Deprecated.
the prefered way is to use the pair of methods
getStateInterface() and getValue(String) |
java.lang.String |
getType()
Returns the type of this control unit.
|
java.lang.Object |
getValue(java.lang.String stateVariableId)
Returns the value of given state variable.
|
boolean |
hasParentsInfo()
Tells whether this object bears parent info.
|
boolean |
read(java.io.DataInputStream in)
Method used for serialization.
|
java.lang.String |
toString() |
void |
write(java.io.DataOutputStream out)
Method used for serialization.
|
public static final java.lang.String NULL_VALUE
protected int mode
ControlUnitInfo. It could be one of the integer constants.protected java.lang.String type
protected java.lang.String id
protected ControlUnitInfo[] parents
protected boolean hasParentsInfo
protected int checksum
SCHECKSUM.protected java.util.Dictionary state
STATE.public static final int ID
ControlUnitInfo is in ID mode, it bears only the cu identifications -
the cu type and cu id.public static final int CHECKSUM
ControlUnitInfo is in SCHECKSUM, it bears a checksum value
for the control unit's state.public static final int STATE
ControlUnitInfo is in STATE, it bears the control
unit's state.public int getMode()
ControlUnitInfo. It could be one of the integer constants.public java.lang.String getType()
public java.lang.String getId()
public java.util.Dictionary getStateVaraibles()
getStateInterface() and getValue(String)STATE.null values are also present in this Dictionary. Their key-value
pair is (stateVarId->NULL_VALUE).public java.lang.String[] getStateInterface()
ControlunitInfo object.public java.lang.Object getValue(java.lang.String stateVariableId)
stateVariableId - id of state variable.IllegalArumentException - if the given state variable does not exist in this info object. Variable ids
that exist in this info object could be obtained through getStateInterface() method.public int getCheckSum()
SCHECKSUM.public boolean hasParentsInfo()
getParentsInfo method.true of this object bears parent info, false otherwise.public ControlUnitInfo[] getParentsInfo()
ID mode.public static final int calcCheckSum(ControlUnitInfo cuInfo)
ControlUnitInfo object in STATE mode.cuInfo - ControlUnitInfo object which checksum should be calculated.java.lang.IllegalArgumentException - if given ControlUnitInfo object is not in STATE mode.public static final int calcCheckSum(java.lang.String[] stateInterface,
java.lang.Object[] values)
stateInterface) and their respective
values (values). The element at position [i] in the values array
must host the value of the state variable in position [i] of the stateInterface
array.stateInterface - list of state variable names.values - list of state variable values.java.lang.IllegalArgumentException - if the arrays passed are not of the same length.public boolean read(java.io.DataInputStream in)
throws java.io.IOException
in - input stream.java.io.IOException - if error while reading data occurs.public void write(java.io.DataOutputStream out)
throws java.io.IOException
out - output stream.java.io.IOException - error while writing data occurs.public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2019 Bosch Software Innovations GmbH. All Rights Reserved.