org.eclipse.app4mc.amalthea.model
Class AmaltheaServices
- Object
-
- AmaltheaServices
-
public class AmaltheaServices extends ObjectThis class provides static methods that implement operations of the Amalthea EMF model.The methods are called from several generated model objects.
-
-
Field Summary
Fields Modifier and Type Field Description static List<TimeUnit>TIME_UNIT_LIST
-
Method Summary
All Methods Modifier and Type Method Description static @NonNull TimeaddTime(@NonNull Time t1, @NonNull Time t2)static @NonNull TimeadjustTimeUnit(@NonNull Time time)This method takes a time (in value and unit) and adjusts the TimeUnit so that the value is as small as possible, without losing precision e.g. 1000us is converted to 1msstatic intcompareDataRates(@NonNull DataRate r1, @NonNull DataRate r2)This method is used to compare DataRate objects on the basis of their values (obtained in bit per second after applying the conversion based on DataRateUnit)static intcompareTimes(@NonNull Time t1, @NonNull Time t2)This method is used to compare Time objects on the basis of their values (obtained in pico seconds after applying the conversion based on TimeUnit)static BigIntegerconvertToBit(@NonNull DataSize size)static BigIntegerconvertToBitPerSecond(@NonNull DataRate rate)static BigDecimalconvertToHertz(@NonNull Frequency frequency)static BigDecimalconvertToMicroVolt(@NonNull Voltage voltage)static BigIntegerconvertToPicoSeconds(@NonNull Time time)This method is used to convert the value of Time/TimeObject element's value to BigInteger in Pico Secondsstatic BigDecimalconvertToSeconds(double time, @NonNull TimeUnit timeUnit)This method is used to convert a time with associated time unit to BigDecimal in secondsstatic BigDecimalconvertToSeconds(@NonNull Time time)This method is used to convert the value of Time/TimeObject element's value to BigDecimal in secondsstatic doubledivideTime(@NonNull Time t1, @NonNull Time t2)Divides t1 by t2static EList<HwModule>getAllModules(@NonNull HwStructure struct)static doublegetAverageOfBetaDistribution(@NonNull Number inputA, @NonNull Number inputB, double alpha, double beta)static TimegetAverageOfBetaDistribution(@NonNull Time a, @NonNull Time b, double alpha, double beta)static doublegetAverageOfTruncatedNormalDistribution(@Nullable Number inputA, @Nullable Number inputB, double mean, double sd)Computes the average (mean) of the truncated normal distributionstatic @NonNull TimegetAverageOfTruncatedNormalDistribution(@Nullable Time a, @Nullable Time b, @NonNull Time mean, @NonNull Time sd)Computes the average (mean) of the truncated normal distributionstatic <T extends EObject>
TgetContainerOfType(@NonNull EObject object, @NonNull Class<T> type)static EList<HwPort>getInnerPorts(@NonNull HwStructure struct)static EList<QualifiedPort>getInnerPorts(@NonNull ISystem system)static @NonNull Timemultiply(@NonNull Time t1, double value)static @NonNull Timemultiply(@NonNull Time t1, long value)static @NonNull TimesubtractTime(@NonNull Time t1, @NonNull Time t2)
-
-
-
Method Detail
-
getContainerOfType
public static <T extends EObject> T getContainerOfType(@NonNull EObject object, @NonNull Class<T> type)
-
convertToBit
public static BigInteger convertToBit(@NonNull DataSize size)
-
convertToBitPerSecond
public static BigInteger convertToBitPerSecond(@NonNull DataRate rate)
-
convertToPicoSeconds
public static BigInteger convertToPicoSeconds(@NonNull Time time)
This method is used to convert the value of Time/TimeObject element's value to BigInteger in Pico Seconds- Parameters:
time- Time object- Returns:
- value BigInteger in Pico Seconds
-
convertToSeconds
public static BigDecimal convertToSeconds(double time, @NonNull TimeUnit timeUnit)This method is used to convert a time with associated time unit to BigDecimal in seconds- Parameters:
time- time as doubletimeUnit- the time unit- Returns:
- value BigDecimal in seconds
-
convertToSeconds
public static BigDecimal convertToSeconds(@NonNull Time time)
This method is used to convert the value of Time/TimeObject element's value to BigDecimal in seconds- Parameters:
time- Time object- Returns:
- value BigDecimal in seconds
-
convertToHertz
public static BigDecimal convertToHertz(@NonNull Frequency frequency)
-
convertToMicroVolt
public static BigDecimal convertToMicroVolt(@NonNull Voltage voltage)
-
compareDataRates
public static int compareDataRates(@NonNull DataRate r1, @NonNull DataRate r2)This method is used to compare DataRate objects on the basis of their values (obtained in bit per second after applying the conversion based on DataRateUnit)- Parameters:
r1- DataRate objectr2- DataRate object- Returns:
- -1 ,0 or 1
-
compareTimes
public static int compareTimes(@NonNull Time t1, @NonNull Time t2)This method is used to compare Time objects on the basis of their values (obtained in pico seconds after applying the conversion based on TimeUnit)- Parameters:
t1- Time objectt2- Time object- Returns:
- -1 ,0 or 1
-
adjustTimeUnit
public static @NonNull Time adjustTimeUnit(@NonNull Time time)
This method takes a time (in value and unit) and adjusts the TimeUnit so that the value is as small as possible, without losing precision e.g. 1000us is converted to 1ms- Parameters:
time-- Returns:
- new Time with adjusted value and unit
-
addTime
public static @NonNull Time addTime(@NonNull Time t1, @NonNull Time t2)
-
subtractTime
public static @NonNull Time subtractTime(@NonNull Time t1, @NonNull Time t2)
-
divideTime
public static double divideTime(@NonNull Time t1, @NonNull Time t2)Divides t1 by t2In case of t2 == 0 the limit t2 -> 0 is used
- Parameters:
t1-t2-- Returns:
- t1 / t2
-
multiply
public static @NonNull Time multiply(@NonNull Time t1, long value)
-
multiply
public static @NonNull Time multiply(@NonNull Time t1, double value)
-
getAverageOfTruncatedNormalDistribution
public static @NonNull Time getAverageOfTruncatedNormalDistribution(@Nullable Time a, @Nullable Time b, @NonNull Time mean, @NonNull Time sd)Computes the average (mean) of the truncated normal distribution- Parameters:
a- lower bound (null = not truncated from below)b- upper bound (null = not truncated from above)mean- mean or expectation of the (unlimited) distributionsd- standard deviation- Returns:
- Average of the truncated distribution
-
getAverageOfTruncatedNormalDistribution
public static double getAverageOfTruncatedNormalDistribution(@Nullable Number inputA, @Nullable Number inputB, double mean, double sd)Computes the average (mean) of the truncated normal distribution- Parameters:
inputA- lower bound (null = not truncated from below)inputB- upper bound (null = not truncated from above)mean- mean or expectation of the (unlimited) distributionsd- standard deviation- Returns:
- Average of the truncated distribution
-
getAverageOfBetaDistribution
public static Time getAverageOfBetaDistribution(@NonNull Time a, @NonNull Time b, double alpha, double beta)
-
getAverageOfBetaDistribution
public static Double getAverageOfBetaDistribution(@NonNull Number inputA, @NonNull Number inputB, double alpha, double beta)
-
getInnerPorts
public static EList<QualifiedPort> getInnerPorts(@NonNull ISystem system)
-
getInnerPorts
public static EList<HwPort> getInnerPorts(@NonNull HwStructure struct)
-
getAllModules
public static EList<HwModule> getAllModules(@NonNull HwStructure struct)
-
-