TDI-32659: Tmap:the function "Talenddate"-"diffdate" is not correct
https://jira.talendforge.org/browse/TDI-32659
This commit is contained in:
@@ -13,21 +13,21 @@ public class Numeric {
|
||||
|
||||
/**
|
||||
* return an incremented numeric id
|
||||
*
|
||||
*
|
||||
* {talendTypes} int | Integer
|
||||
*
|
||||
*
|
||||
* {Category} Numeric
|
||||
*
|
||||
*
|
||||
* {param} string("s1") sequence identifier
|
||||
*
|
||||
*
|
||||
* {param} int(1) start value
|
||||
*
|
||||
*
|
||||
* {param} int(1) step
|
||||
*
|
||||
*
|
||||
* {example} sequence("s1", 1, 1) # 1, 2, 3, ...
|
||||
*
|
||||
*
|
||||
* {example} sequence("s2", 100, -2) # 100, 98, 96, ...
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static Integer sequence(String seqName, int startValue, int step) {
|
||||
if (seq_Hash.containsKey(seqName)) {
|
||||
@@ -41,15 +41,15 @@ public class Numeric {
|
||||
|
||||
/**
|
||||
* create a sequence if not exists and put a new startValue
|
||||
*
|
||||
*
|
||||
* {Category} Numeric
|
||||
*
|
||||
*
|
||||
* {param} string("s1") sequence identifier
|
||||
*
|
||||
*
|
||||
* {param} int(1) start value
|
||||
*
|
||||
*
|
||||
* {example} sequence("s1", 1)
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public static void resetSequence(String seqName, int startValue) {
|
||||
@@ -58,13 +58,13 @@ public class Numeric {
|
||||
|
||||
/**
|
||||
* remove a sequence
|
||||
*
|
||||
*
|
||||
* {Category} Numeric
|
||||
*
|
||||
*
|
||||
* {param} string("s1") sequence identifier
|
||||
*
|
||||
*
|
||||
* {example} sequence("s1")
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public static void removeSequence(String seqName) {
|
||||
@@ -75,19 +75,19 @@ public class Numeric {
|
||||
|
||||
/**
|
||||
* return a random int between min and max
|
||||
*
|
||||
*
|
||||
* {Category} Numeric
|
||||
*
|
||||
*
|
||||
* {talendTypes} int | Integer
|
||||
*
|
||||
*
|
||||
* {param} int(0) min value
|
||||
*
|
||||
*
|
||||
* {param} int(100) max value
|
||||
*
|
||||
*
|
||||
* {example} random(3, 10) # 7, 4, 8, ...
|
||||
*
|
||||
*
|
||||
* {example} random(0, 100) # 93, 12, 83, ...
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static Integer random(Integer min, Integer max) {
|
||||
return ((Long) Math.round(min - 0.5 + (Math.random() * (max - min + 1)))).intValue();
|
||||
@@ -95,17 +95,17 @@ public class Numeric {
|
||||
|
||||
/**
|
||||
* return numbers using an implied decimal format.
|
||||
*
|
||||
*
|
||||
* {Category} Numeric
|
||||
*
|
||||
*
|
||||
* {talendTypes} float | Float
|
||||
*
|
||||
*
|
||||
* {param} String("9V99") format: float pointing format.
|
||||
*
|
||||
*
|
||||
* {param} String("123") toConvert: read this value.
|
||||
*
|
||||
*
|
||||
* {example} convertImpliedDecimalFormat("9V99", "123") result: 1.23 ...
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static Float convertImpliedDecimalFormat(String format, String toConvert) {
|
||||
BigDecimal decimal = Numeric.convertString2BigDecimal(format,toConvert);
|
||||
|
||||
Reference in New Issue
Block a user