Package com.piketec.tpt.api
Interface Unit
-
- All Superinterfaces:
IdentifiableRemote
,java.rmi.Remote
,TptRemote
public interface Unit extends IdentifiableRemote
A physical unit.- 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 int
getBinaryExponent()
Returns the power of two of this units factor.int
getDecimalExponent()
Returns the power of ten of this units factor.int
getDenominator()
Returns the denominator of this units factor.java.util.Map<Unit,java.lang.Short>
getDependencies()
Returns the units dependencies.java.lang.String
getName()
Returns the name of this unit.int
getNumerator()
Returns the numerator of this units factor.double
getOffset()
Returns the offset of this unitint
getPiExponent()
Returns the power of π of this units factor.java.lang.String
getSymbol()
Returns the units symbol.boolean
isBaseUnit()
Returnstrue
if this unit has no dependencies to other units,false
otherwise.boolean
isEditable()
Returnstrue
if this unit is editable,false
otherwise.void
setBinaryExponent(int exponent)
Set the exponent to the base of two of this units factorvoid
setDecimalExponent(int exponent)
Set the exponent to the base of ten of this units factorvoid
setDenominator(int denominator)
Set the denominator of this units factor.void
setDependency(Unit unit, short exponent)
Set the dependency of this unit to the givenunit
by defining an exponent.void
setFactor(int numerator, int denominator, int decimalExponent, int binaryExponent, int piExponent)
Sets the wholefactor of the Unit.void
setName(java.lang.String name)
Set the name of this unit.void
setNumerator(int numerator)
Set the numerator of this units factor.void
setOffset(double offset)
Set the offset of this unit.void
setPiExponent(int exponent)
Set the exponent to the base of π of this units factorvoid
setSymbol(java.lang.String symbol)
Set the symbol of this unit.-
Methods inherited from interface com.piketec.tpt.api.IdentifiableRemote
getIdentifier
-
-
-
-
Method Detail
-
getName
java.lang.String getName() throws java.rmi.RemoteException
Returns the name of this unit.- Returns:
- name of this unit
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setName
void setName(java.lang.String name) throws ApiException, java.rmi.RemoteException
Set the name of this unit.- Parameters:
name
- to be set.- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable, the given name has illegal characters or a unit with the same name or symbol already exists
-
getSymbol
java.lang.String getSymbol() throws java.rmi.RemoteException
Returns the units symbol.- Returns:
- symbol of this unit
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setSymbol
void setSymbol(java.lang.String symbol) throws ApiException, java.rmi.RemoteException
Set the symbol of this unit.- Parameters:
symbol
- to be set.- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable, the given symbol has illegal characters or a unit with the same name or symbol already exists
-
getOffset
double getOffset() throws java.rmi.RemoteException
Returns the offset of this unit- Returns:
- unit offset
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setOffset
void setOffset(double offset) throws ApiException, java.rmi.RemoteException
Set the offset of this unit.- Parameters:
offset
- to be set.- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable
-
getNumerator
int getNumerator() throws java.rmi.RemoteException
Returns the numerator of this units factor.- Returns:
- numerator
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setNumerator
void setNumerator(int numerator) throws ApiException, java.rmi.RemoteException
Set the numerator of this units factor.- Parameters:
numerator
- to be set.- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable
-
getDenominator
int getDenominator() throws java.rmi.RemoteException
Returns the denominator of this units factor.- Returns:
- denominator
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setDenominator
void setDenominator(int denominator) throws ApiException, java.rmi.RemoteException
Set the denominator of this units factor.- Parameters:
denominator
- to be set.- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable
-
getDecimalExponent
int getDecimalExponent() throws java.rmi.RemoteException
Returns the power of ten of this units factor.- Returns:
- decimal exponent for numerator
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setDecimalExponent
void setDecimalExponent(int exponent) throws ApiException, java.rmi.RemoteException
Set the exponent to the base of ten of this units factor- Parameters:
exponent
- to be set- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable
-
getBinaryExponent
int getBinaryExponent() throws java.rmi.RemoteException
Returns the power of two of this units factor.- Returns:
- binary exponent for numerator
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setBinaryExponent
void setBinaryExponent(int exponent) throws ApiException, java.rmi.RemoteException
Set the exponent to the base of two of this units factor- Parameters:
exponent
- to be set- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable
-
getPiExponent
int getPiExponent() throws java.rmi.RemoteException
Returns the power of π of this units factor.- Returns:
- PI exponent for numerator
- Throws:
java.rmi.RemoteException
- remote communication problem
-
setPiExponent
void setPiExponent(int exponent) throws ApiException, java.rmi.RemoteException
Set the exponent to the base of π of this units factor- Parameters:
exponent
- to be set- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if unit is not editable
-
getDependencies
java.util.Map<Unit,java.lang.Short> getDependencies() throws java.rmi.RemoteException
Returns the units dependencies. To remove a dependency to an other unit set its exponent to 0.- Returns:
- map of all base unit dependencies
- Throws:
java.rmi.RemoteException
- remote communication problem- See Also:
setDependency(Unit, short)
-
setDependency
void setDependency(Unit unit, short exponent) throws ApiException, java.rmi.RemoteException
Set the dependency of this unit to the givenunit
by defining an exponent. To remove a dependency set the exponent to0
.- Parameters:
unit
- The unit this unit shall get a dependency to.exponent
- The exponent of the dependency- Throws:
java.rmi.RemoteException
- remote communication problemApiException
- if this unit is not editable, if the other unit is not a base unit.
-
isEditable
boolean isEditable() throws java.rmi.RemoteException
Returnstrue
if this unit is editable,false
otherwise.- Returns:
true
if this unit is editable- Throws:
java.rmi.RemoteException
- remote communication problem
-
isBaseUnit
boolean isBaseUnit() throws java.rmi.RemoteException
Returnstrue
if this unit has no dependencies to other units,false
otherwise.- Returns:
true
if this unit has no dependencies to other units- Throws:
java.rmi.RemoteException
- remote communication problem
-
setFactor
void setFactor(int numerator, int denominator, int decimalExponent, int binaryExponent, int piExponent) throws ApiException, java.rmi.RemoteException
Sets the wholefactor of the Unit.- Parameters:
numerator
- to be set.denominator
- to be set.decimalExponent
- to be set.binaryExponent
- to be set.piExponent
- to be set.- Throws:
ApiException
- if unit is not editablejava.rmi.RemoteException
- remote communication problem
-
-