Package com.piketec.tpt.api
Interface Declaration
-
- All Superinterfaces:
IdentifiableRemote
,NamedObject
,java.rmi.Remote
,TptRemote
- All Known Subinterfaces:
AssessmentVariable
,Channel
,Constant
,Measurement
,Parameter
public interface Declaration extends NamedObject, IdentifiableRemote
ADeclaration
is either a signal or a parameter or a constant.- Author:
- Copyright (c) 2014-2024 Piketec GmbH - MIT License (MIT) - All rights reserved
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getDefaultValue()
Get the default value of the declaration.java.lang.String
getDescription()
Get the description of the declaration.java.lang.String
getGroup()
Type
getType()
Get the type of the declaration.java.lang.String
getUnit()
Returns the name of the unit of the declaration.Unit
getUnitObject()
Returns theUnit
set to this declaration.void
setDefaultValue(java.lang.String defaultValue)
Set the default value of the declaration.void
setDescription(java.lang.String description)
Set the description of the declaration.void
setGroup(java.lang.String group)
Set the group the declaration should belong to.void
setType(Type type)
Set the type of the declaration.void
setUnit(Unit unit)
Set the unit of this declaration.void
setUnit(java.lang.String unit)
Set the unit of the declaration.-
Methods inherited from interface com.piketec.tpt.api.IdentifiableRemote
getIdentifier
-
Methods inherited from interface com.piketec.tpt.api.NamedObject
getName, setName
-
-
-
-
Method Detail
-
getGroup
java.lang.String getGroup() throws java.rmi.RemoteException
- Returns:
- The group the declaration belongs to. Empty String if no Group is defined.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setGroup
void setGroup(java.lang.String group) throws java.rmi.RemoteException
Set the group the declaration should belong to.- Parameters:
group
- The new group.Null
or an string containing only whitespaces will be reduced to an empty string.- Throws:
java.rmi.RemoteException
- remote communication problem
-
getUnit
java.lang.String getUnit() throws java.rmi.RemoteException
Returns the name of the unit of the declaration. For complex types units of subvariables are united.
For unstructured declarations it is recommended to usegetUnitObject()
.- Returns:
- current unit as a string
- Throws:
java.rmi.RemoteException
- remote communication problem
-
getUnitObject
Unit getUnitObject() throws ApiException, java.rmi.RemoteException
Returns theUnit
set to this declaration. The method is only allowed on non-structured declarations. UsegetUnit()
for structured declarations.- Returns:
- the unit for this declaration or
null
if no unit is set. - Throws:
java.rmi.RemoteException
- remote communication problemApiException
- If this declaration has a structured type.
-
setUnit
void setUnit(java.lang.String unit) throws ApiException, java.rmi.RemoteException
Set the unit of the declaration. For structs, maps and curves provide a comma separated list of units in braces, which fits their structure. The units name and symbol can be used.
For unstructured declarations it is recommended to usesetUnit(Unit)
.
Note: At the moment single units without curly braces (e.g. "km") are accepted for curves and maps. In this case the unit of the value element will be set. In the future this might be rejected.- Parameters:
unit
- The new unit of the declaration.Null
will be reduced to an empty string.- Throws:
ApiException
- If unit string format is invalid, structure does not match type of the declaration or unit does not exist.java.rmi.RemoteException
- remote communication problem
-
setUnit
void setUnit(Unit unit) throws ApiException, java.rmi.RemoteException
Set the unit of this declaration. The method is only allowed on unstructured declarations. UsesetUnit(String)
for structured declarations.- Parameters:
unit
- to be set ornull
to remove unit.- Throws:
ApiException
- If this declaration has a structured type.java.rmi.RemoteException
- remote communication problem
-
getDefaultValue
java.lang.String getDefaultValue() throws java.rmi.RemoteException
Get the default value of the declaration. The format is the same as seen in tptaif or the declaration editor.- Returns:
- The default value string.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setDefaultValue
void setDefaultValue(java.lang.String defaultValue) throws ApiException, java.rmi.RemoteException
Set the default value of the declaration. The format is the same as seen in tptaif or the declaration editor.- Parameters:
defaultValue
- The new default value.- Throws:
ApiException
- If the givendefaultValue
string could not be parsed.java.rmi.RemoteException
- remote communication problem
-
getType
Type getType() throws java.rmi.RemoteException
Get the type of the declaration.- Returns:
- The type of the declaration.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setType
void setType(Type type) throws ApiException, java.rmi.RemoteException
Set the type of the declaration. Anonymous types are copied so the following code will return false:Type anonymousType = project.createType(null, "float[]"); Channel channel = project.createChannel("myChannel"); channel.setType(anonymousType); return channel.getType().equals(anonymousType); // false
If the new type is a struct, map or curve and the declaration has a unit set, the unit will be removed since units are not allowed for declarations of these types.- Parameters:
type
- The new type of the declaration. This will reset the default value.- Throws:
ApiException
- If the given type is unknown in the TPT project.java.rmi.RemoteException
- remote communication problem
-
getDescription
java.lang.String getDescription() throws java.rmi.RemoteException
Get the description of the declaration.- Returns:
- The description of the declaration.
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setDescription
void setDescription(java.lang.String description) throws java.rmi.RemoteException
Set the description of the declaration.- Parameters:
description
- The new description of the declaration.Null
will be reduced to an empty string.- Throws:
java.rmi.RemoteException
- remote communication problem
-
-