public class VariableAccessWithBitmask extends java.lang.Object implements VariableAccess_ifc
| Modifier and Type | Field and Description |
|---|---|
protected int |
bit
The position of the last significant bit if the value of the variable is placed in some bits
or specially in only one bit, a boolean value. 0 per default.
|
protected int |
mask
The mask to access to some bits.
|
protected VariableAccess_ifc |
variable
The entity of a variable.
|
static int |
version
Version, history and license
2013-12-20 Hartmut new from @
VariableAccessWithIdx, it uses a simple VariableAccess_ifc,
not the VariableAccessArray_ifc. |
| Constructor and Description |
|---|
VariableAccessWithBitmask(VariableAccess_ifc variable) |
VariableAccessWithBitmask(VariableAccess_ifc variable,
int bit,
int mask) |
| Modifier and Type | Method and Description |
|---|---|
double |
getDouble()
Gets the value from this variable.
|
float |
getFloat()
Returns the presentation float value for the integer bits in the variable.
|
int |
getInt()
Returns the integer representation of the value of the variable.
|
long |
getLastRefreshTime()
Gets the time stamp when this variable was refreshed lastly.
|
int[] |
getLastRefreshTimeShort()
Returns a pair of timeShort and timeShortAdd (see
Timeshort)
of the last refresh time if timeAbs is not available
or the necessary resolution should be finer than 1 ms. |
long |
getLong()
Returns the integer representation of the value of the variable.
|
java.lang.String |
getString()
Gets the value from this variable.
|
char |
getType()
Returns the type of the variable:
|
VariableAccess_ifc |
getVariable() |
boolean |
isRefreshed()
Returns true if the variable was refreshed after it was requested.
|
boolean |
isRequestedValue(long timeEarlyRequested,
boolean retryFaultyVariables)
Returns true if the request is newer than the last refresh.
|
void |
requestValue()
Requests a new value from the target device with the
System.currentTimeMillis() |
void |
requestValue(long timeRequested)
Requests a new value from the target device.
|
void |
requestValue(long timeRequested,
java.lang.Runnable run)
Requests a new value from the target device.
|
double |
setDouble(double value)
Sets the value from this variable.
|
float |
setFloat(float value)
Sets a float to the variable.
|
int |
setInt(int value)
Sets the value into the variable.
|
long |
setLong(long value)
Sets the value into the variable.
|
void |
setRefreshed(long time) |
java.lang.String |
setString(java.lang.String src)
Sets the value into the variable
|
public static final int version
VariableAccessWithIdx, it uses a simple VariableAccess_ifc,
not the VariableAccessArray_ifc. The source is more simple.
Note: The VariableAccessWithIdx support both, index and bits.
protected final VariableAccess_ifc variable
protected final int mask
protected final int bit
public VariableAccessWithBitmask(VariableAccess_ifc variable, int bit, int mask)
public VariableAccessWithBitmask(VariableAccess_ifc variable)
public double getDouble()
VariableAccess_ifcgetDouble in interface VariableAccess_ifcpublic float getFloat()
getFloat in interface VariableAccess_ifcVariableAccess_ifc.getFloat()public java.lang.String getString()
VariableAccess_ifcgetString in interface VariableAccess_ifcpublic void setRefreshed(long time)
setRefreshed in interface VariableAccess_ifcpublic long getLastRefreshTime()
VariableAccess_ifcgetLastRefreshTime in interface VariableAccess_ifcpublic int[] getLastRefreshTimeShort()
VariableAccess_ifcTimeshort)
of the last refresh time if timeAbs is not available
or the necessary resolution should be finer than 1 ms.getLastRefreshTimeShort in interface VariableAccess_ifcpublic char getType()
VariableAccess_ifcgetType in interface VariableAccess_ifcpublic int getInt()
getInt in interface VariableAccess_ifcpublic long getLong()
getLong in interface VariableAccess_ifcpublic VariableAccess_ifc getVariable()
public float setFloat(float value)
#setFloat(float, int...). The index may be stored here.setFloat in interface VariableAccess_ifcvalue - public java.lang.String setString(java.lang.String src)
VariableAccess_ifcsetString in interface VariableAccess_ifcsrc - The value given as String.public void requestValue(long timeRequested)
VariableAccess_ifcrequestValue in interface VariableAccess_ifctimeRequested - the current time, used to mark the request.public void requestValue()
VariableAccess_ifcSystem.currentTimeMillis()requestValue in interface VariableAccess_ifcpublic void requestValue(long timeRequested,
java.lang.Runnable run)
VariableAccess_ifcrequestValue in interface VariableAccess_ifctimeRequested - the current timerun - method which should be invoked if the request is resolved, optional operation.public boolean isRequestedValue(long timeEarlyRequested,
boolean retryFaultyVariables)
VariableAccess_ifcisRequestedValue in interface VariableAccess_ifctimeEarlyRequested - The earliest time where the variable is requested. If the request time is more early, it is not regarded.
This is since 2016-01. An old request should be ignored but the time stamp of the request should be visible for debug or view the state.retryFaultyVariables - A variable which is set to invalid is requested though.public boolean isRefreshed()
VariableAccess_ifcisRefreshed in interface VariableAccess_ifcpublic double setDouble(double value)
VariableAccess_ifcsetDouble in interface VariableAccess_ifcpublic int setInt(int value)
VariableAccess_ifcsetInt in interface VariableAccess_ifcvalue - The value given as int.public long setLong(long value)
VariableAccess_ifcsetLong in interface VariableAccess_ifcvalue - The value given as int.