@ProviderType
public interface DataModel
This interface is used for storing and managing data that represents the current configuration of, e.g. a
ProgramNodeContribution
or InstallationNodeContribution
.
Methods for adding, removing, retrieving and changing values in a dictionary are provided.
Setting a new value for a key already in use, will overwrite the current value with the new value. This happens
regardless of the type of value (e.g. storing the value true
under the key myBool and afterwards storing
an Angle
object under the same key will overwrite the value true
with the provided Angle
object).
Setting a null
value for a key, will remove the key and its value, if it exists, from the data model.
A URCap installation screen has an underlying DataModel
object. That object is saved and loaded along with each
PolyScope installation.
Similarly, each contributed program node instance has an underlying DataModel
object. That object is saved and
loaded along with the program where the node occurs.
Undo/redo actions are supported for all modifications to the DataModel
object in HTML-based program node contributions.
Swing-based URCaps must use the UndoRedoManager
to record the changes on the undo/redo stack.
When retrieving an object, both key and object type must match what was previously stored. This means that if a
TCP
object was stored using the key myAngle, then attempting to retrieve it using
get(String key, Angle defaultValue)
with the key myAngle will not return the stored value, since the
types do not match. Instead the provided defaultValue
will be returned.
Modifier and Type | Method and Description |
---|---|
Acceleration |
get(String key,
Acceleration defaultValue)
Get the
Acceleration value assigned to the specified key. |
Angle |
get(String key,
Angle defaultValue)
Get the
Angle value assigned to the specified key. |
AngularAcceleration |
get(String key,
AngularAcceleration defaultValue)
Get the
AngularAcceleration value assigned to the specified key. |
AngularSpeed |
get(String key,
AngularSpeed defaultValue)
Get the
AngularSpeed value assigned to the specified key. |
boolean |
get(String key,
boolean defaultValue)
Get the
boolean value assigned to the specified key. |
boolean[] |
get(String key,
boolean[] defaultValue)
Get the
boolean[] as value assigned to the specified key. |
Current |
get(String key,
Current defaultValue)
Get the
Current value assigned to the specified key. |
double |
get(String key,
double defaultValue)
Get the
double value assigned to the specified key. |
double[] |
get(String key,
double[] defaultValue)
Get the
double[] as value assigned to the specified key. |
Feature |
get(String key,
Feature defaultValue)
Get the
Feature value assigned to the specified key. |
float |
get(String key,
float defaultValue)
Get the
float value assigned to the specified key. |
float[] |
get(String key,
float[] defaultValue)
Get the
float[] as value assigned to the specified key. |
Force |
get(String key,
Force defaultValue)
Get the
Force value assigned to the specified key. |
int |
get(String key,
int defaultValue)
Get the
int value assigned to the specified key. |
int[] |
get(String key,
int[] defaultValue)
Get the
int[] as value assigned to the specified key. |
JointPositions |
get(String key,
JointPositions defaultValue)
Get the
JointPositions value assigned to the specified key. |
Length |
get(String key,
Length defaultValue)
Get the
Length value assigned to the specified key. |
long |
get(String key,
long defaultValue)
Get the
long value assigned to the specified key. |
long[] |
get(String key,
long[] defaultValue)
Get the
long[] as value assigned to the specified key. |
Mass |
get(String key,
Mass defaultValue)
Get the
Mass value assigned to the specified key. |
Payload |
get(String key,
Payload defaultValue)
Get the
Payload value assigned to the specified key. |
Pose |
get(String key,
Pose defaultValue)
Get the
Pose value assigned to the specified key. |
Position |
get(String key,
Position defaultValue)
Get the
Position value assigned to the specified key. |
Pressure |
get(String key,
Pressure defaultValue)
Get the
Pressure value assigned to the specified key. |
Rotation |
get(String key,
Rotation defaultValue)
Get the
Rotation value assigned to the specified key. |
Speed |
get(String key,
Speed defaultValue)
Get the
Speed value assigned to the specified key. |
String |
get(String key,
String defaultValue)
Get the
String value assigned to the specified key. |
String[] |
get(String key,
String[] defaultValue)
Get the
String[] as value assigned to the specified key. |
<T extends Device> |
get(String key,
T defaultValue,
Class<T> deviceClassType)
Get the
Device value assigned to the specified key. |
TCP |
get(String key,
TCP defaultValue)
Get the
TCP value assigned to the specified key. |
Time |
get(String key,
Time defaultValue)
Get the
Time value assigned to the specified key. |
Torque |
get(String key,
Torque defaultValue)
Get the
Torque value assigned to the specified key. |
Variable |
get(String key,
Variable defaultValue)
Get the
Variable value assigned to the specified key. |
Voltage |
get(String key,
Voltage defaultValue)
Get the
Voltage value assigned to the specified key. |
Set<String> |
getKeys()
Get a set of all the keys in the data model.
|
boolean |
isSet(String key)
Check if a key is present in the data model.
|
boolean |
remove(String key)
Remove a key-value pair from the data model.
|
void |
set(String key,
Acceleration value)
Assign an
Acceleration value to the specified key. |
void |
set(String key,
Angle value)
Assign an
Angle value to the specified key. |
void |
set(String key,
AngularAcceleration value)
Assign an
AngularAcceleration value to the specified key. |
void |
set(String key,
AngularSpeed value)
Assign an
AngularSpeed value to the specified key. |
void |
set(String key,
boolean value)
Assign a
boolean value to the specified key. |
void |
set(String key,
boolean[] value)
Assign a
boolean[] as value to the specified key. |
void |
set(String key,
Current value)
Assign a
Current value to the specified key. |
void |
set(String key,
Device value)
Assign a
Device value to the specified key. |
void |
set(String key,
double value)
Assign a
double value to the specified key. |
void |
set(String key,
double[] value)
Assign a
double[] as value to the specified key. |
void |
set(String key,
Feature value)
Assign a
Feature value to the specified key. |
void |
set(String key,
float value)
Assign a
float value to the specified key. |
void |
set(String key,
float[] value)
Assign a
float[] as value to the specified key. |
void |
set(String key,
Force value)
Assign a
Force value to the specified key. |
void |
set(String key,
int value)
Assign an
int value to the specified key. |
void |
set(String key,
int[] value)
Assign a
int[] as value to the specified key. |
void |
set(String key,
JointPositions value)
Assign a
JointPositions value to the specified key. |
void |
set(String key,
Length value)
Assign a
Length value to the specified key. |
void |
set(String key,
long value)
Assign a
long value to the specified key. |
void |
set(String key,
long[] value)
Assign a
long[] as value to the specified key. |
void |
set(String key,
Mass value)
Assign a
Mass value to the specified key. |
void |
set(String key,
Payload value)
Assign a
Payload value to the specified key. |
void |
set(String key,
Pose value)
Assign a
Pose value to the specified key. |
void |
set(String key,
Position value)
Assign a
Position value to the specified key. |
void |
set(String key,
Pressure value)
Assign a
Pressure value to the specified key. |
void |
set(String key,
Rotation value)
Assign a
Rotation value to the specified key. |
void |
set(String key,
Speed value)
Assign a
Speed value to the specified key. |
void |
set(String key,
String value)
Assign a
String value to the specified key. |
void |
set(String key,
String[] value)
Assign a
String[] as value to the specified key. |
void |
set(String key,
TCP value)
Assign a
TCP value to the specified key. |
void |
set(String key,
Time value)
Assign a
Time value to the specified key. |
void |
set(String key,
Torque value)
Assign a
Torque value to the specified key. |
void |
set(String key,
Variable value)
Assign a
Variable value to the specified key. |
void |
set(String key,
Voltage value)
Assign a
Voltage value to the specified key. |
void set(String key, boolean value)
boolean
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).boolean get(String key, boolean defaultValue)
boolean
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, int value)
int
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).int get(String key, int defaultValue)
int
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, long value)
long
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).long get(String key, long defaultValue)
long
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, float value)
float
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).float get(String key, float defaultValue)
float
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, double value)
double
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).double get(String key, double defaultValue)
double
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, String value)
String
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).String get(String key, String defaultValue)
String
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, JointPositions value)
JointPositions
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).JointPositions get(String key, JointPositions defaultValue)
JointPositions
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Variable value)
Variable
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Variable get(String key, Variable defaultValue)
Variable
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Acceleration value)
Acceleration
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Acceleration get(String key, Acceleration defaultValue)
Acceleration
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Angle value)
Angle
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Angle get(String key, Angle defaultValue)
Angle
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, AngularAcceleration value)
AngularAcceleration
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).AngularAcceleration get(String key, AngularAcceleration defaultValue)
AngularAcceleration
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, AngularSpeed value)
AngularSpeed
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).AngularSpeed get(String key, AngularSpeed defaultValue)
AngularSpeed
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Current value)
Current
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Current get(String key, Current defaultValue)
Current
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Force value)
Force
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Force get(String key, Force defaultValue)
Force
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Length value)
Length
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Length get(String key, Length defaultValue)
Length
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Mass value)
Mass
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Mass get(String key, Mass defaultValue)
Mass
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Pose value)
Pose
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Pose get(String key, Pose defaultValue)
Pose
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Position value)
Position
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Position get(String key, Position defaultValue)
Position
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Pressure value)
Pressure
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Pressure get(String key, Pressure defaultValue)
Pressure
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Rotation value)
Rotation
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Rotation get(String key, Rotation defaultValue)
Rotation
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Speed value)
Speed
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Speed get(String key, Speed defaultValue)
Speed
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Time value)
Time
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Time get(String key, Time defaultValue)
Time
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Torque value)
Torque
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Torque get(String key, Torque defaultValue)
Torque
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Voltage value)
Voltage
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Voltage get(String key, Voltage defaultValue)
Voltage
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, boolean[] value)
boolean[]
as value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).boolean[] get(String key, boolean[] defaultValue)
boolean[]
as value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, int[] value)
int[]
as value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).int[] get(String key, int[] defaultValue)
int[]
as value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, long[] value)
long[]
as value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).long[] get(String key, long[] defaultValue)
long[]
as value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, float[] value)
float[]
as value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).float[] get(String key, float[] defaultValue)
float[]
as value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, double[] value)
double[]
as value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).double[] get(String key, double[] defaultValue)
double[]
as value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, String[] value)
String[]
as value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).String[] get(String key, String[] defaultValue)
String[]
as value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, TCP value)
TCP
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).TCP get(String key, TCP defaultValue)
TCP
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Feature value)
Feature
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Feature get(String key, Feature defaultValue)
Feature
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Payload value)
Payload
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Payload get(String key, Payload defaultValue)
Payload
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.void set(String key, Device value)
Device
value to the specified key.key
- key in the data model (not null
and not an empty String
).value
- value assigned to key.IllegalArgumentException
- if the key is null
or an empty String
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).<T extends Device> T get(String key, T defaultValue, Class<T> deviceClassType)
Device
value assigned to the specified key.key
- key in the data model.defaultValue
- value to be returned, if key does not exist.deviceClassType
- device class type to be returned.Set<String> getKeys()
boolean isSet(String key)
key
- key in the data model (not null
and not an empty String
).true
, if key exist, otherwise false
.boolean remove(String key)
key
- key in the data model (not null
and not an empty String
).true
, if succeed, otherwise false
.IllegalStateException
- if called from a Swing-based URCap program node outside of an UndoableChanges
scope (see also UndoRedoManager
).Copyright © 2021. All rights reserved.