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_ifc
getDouble
in interface VariableAccess_ifc
public float getFloat()
getFloat
in interface VariableAccess_ifc
VariableAccess_ifc.getFloat()
public java.lang.String getString()
VariableAccess_ifc
getString
in interface VariableAccess_ifc
public void setRefreshed(long time)
setRefreshed
in interface VariableAccess_ifc
public long getLastRefreshTime()
VariableAccess_ifc
getLastRefreshTime
in interface VariableAccess_ifc
public int[] getLastRefreshTimeShort()
VariableAccess_ifc
Timeshort
)
of the last refresh time if timeAbs is not available
or the necessary resolution should be finer than 1 ms.getLastRefreshTimeShort
in interface VariableAccess_ifc
public char getType()
VariableAccess_ifc
getType
in interface VariableAccess_ifc
public int getInt()
getInt
in interface VariableAccess_ifc
public long getLong()
getLong
in interface VariableAccess_ifc
public VariableAccess_ifc getVariable()
public float setFloat(float value)
#setFloat(float, int...)
. The index may be stored here.setFloat
in interface VariableAccess_ifc
value
- public java.lang.String setString(java.lang.String src)
VariableAccess_ifc
setString
in interface VariableAccess_ifc
src
- The value given as String.public void requestValue(long timeRequested)
VariableAccess_ifc
requestValue
in interface VariableAccess_ifc
timeRequested
- the current time, used to mark the request.public void requestValue()
VariableAccess_ifc
System.currentTimeMillis()
requestValue
in interface VariableAccess_ifc
public void requestValue(long timeRequested, java.lang.Runnable run)
VariableAccess_ifc
requestValue
in interface VariableAccess_ifc
timeRequested
- the current timerun
- method which should be invoked if the request is resolved, optional operation.public boolean isRequestedValue(long timeEarlyRequested, boolean retryFaultyVariables)
VariableAccess_ifc
isRequestedValue
in interface VariableAccess_ifc
timeEarlyRequested
- 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_ifc
isRefreshed
in interface VariableAccess_ifc
public double setDouble(double value)
VariableAccess_ifc
setDouble
in interface VariableAccess_ifc
public int setInt(int value)
VariableAccess_ifc
setInt
in interface VariableAccess_ifc
value
- The value given as int.public long setLong(long value)
VariableAccess_ifc
setLong
in interface VariableAccess_ifc
value
- The value given as int.