Package ru.proninyaroslav.template
Class BuiltinsFuncs
java.lang.Object
ru.proninyaroslav.template.BuiltinsFuncs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectEvaluates a + bstatic ObjectComputes the boolean AND of its arguments, returning the first false argument it encounters, or the last argumentstatic booleanstatic StringdefaultValue(Object arg1) Supports default value in case variable is nullstatic StringdefaultValue(Object arg1, Object arg2) Supports default value in case variable is nullstatic ObjectEvaluates a / bstatic ObjectdoArithmetic(Object a, Object b, char op) static booleanEvaluates the comparison a == b || a == c || ...static booleangreaterThan(Object a, Object b) Evaluates the comparison a > bstatic booleangreaterThanOrEqual(Object a, Object b) Evaluates the comparison a >= bstatic ObjectReturns the result of indexing its first argument by the following arguments, e.g.static booleanEvaluates the comparison a < bstatic booleanlessThanOrEqual(Object a, Object b) Evaluates the comparison a <= bstatic ObjectEvaluates a % bstatic ObjectEvaluates a * bstatic booleanReturns the boolean negation of its argumentstatic booleanEvaluates the comparison a != bstatic ObjectComputes the boolean OR of its arguments, returning the first true argument it encounters, or the last argumentstatic StringUses the default formats for its arguments and returns the resulting string.static StringUses the default formats for its arguments and returns the resulting string.static int[]range(int stop) Generate number sequence from 0 to stop with a given step (default 1)static int[]range(int start, int stop) Generate number sequence from start to stop with a given step (default 1)static int[]range(int start, int stop, int step) Generate number sequence from start to stop with a given stepstatic ObjectEvaluates a - bstatic StringUses URL Encoding for it's argument
-
Constructor Details
-
BuiltinsFuncs
public BuiltinsFuncs()
-
-
Method Details
-
range
public static int[] range(int stop) Generate number sequence from 0 to stop with a given step (default 1)- Parameters:
stop- stop value- Returns:
- number sequence
-
range
public static int[] range(int start, int stop) Generate number sequence from start to stop with a given step (default 1)- Parameters:
start- start valuestop- stop value- Returns:
- number sequence
-
range
public static int[] range(int start, int stop, int step) Generate number sequence from start to stop with a given step- Parameters:
start- start valuestop- stop valuestep- step value- Returns:
- number sequence
-
index
Returns the result of indexing its first argument by the following arguments, e.g. index x 1 2 3 returns x[1][2][3] (or x.get(1).get(2).get(3) if object is List or Map)- Parameters:
arr- arrayindexes- indexes- Returns:
- object or value
-
print
Uses the default formats for its arguments and returns the resulting string. Spaces are added between arguments when neither is a string- Parameters:
args- arguments- Returns:
- formatted string
-
println
Uses the default formats for its arguments and returns the resulting string. Spaces are always added between operands and a newline is appended- Parameters:
args- arguments- Returns:
- formatted string
-
equal
Evaluates the comparison a == b || a == c || ...- Parameters:
arg1- first valuearg2- second value- Returns:
- comparison result
-
notEqual
Evaluates the comparison a != b- Parameters:
a- first valueb- second value- Returns:
- comparison result
-
lessThan
Evaluates the comparison a < b- Parameters:
a- first valueb- second value- Returns:
- comparison result
-
lessThanOrEqual
Evaluates the comparison a <= b- Parameters:
a- first valueb- second value- Returns:
- comparison result
-
greaterThan
Evaluates the comparison a > b- Parameters:
a- first valueb- second value- Returns:
- comparison result
-
greaterThanOrEqual
Evaluates the comparison a >= b- Parameters:
a- first valueb- second value- Returns:
- comparison result
-
not
Returns the boolean negation of its argument- Parameters:
a- value- Returns:
- inversion result
-
and
Computes the boolean AND of its arguments, returning the first false argument it encounters, or the last argument- Parameters:
arg0- first argumentargs- other arguments- Returns:
- false argument
-
or
Computes the boolean OR of its arguments, returning the first true argument it encounters, or the last argument- Parameters:
arg0- first argumentargs- other arguments- Returns:
- true argument
-
add
Evaluates a + b- Parameters:
a- first summandb- second summand- Returns:
- sum
-
sub
Evaluates a - b- Parameters:
a- minuendb- subtrahend- Returns:
- difference
-
mul
Evaluates a * b- Parameters:
a- multiplicandsb- multiplier- Returns:
- product
-
div
Evaluates a / b- Parameters:
a- dividendb- divisor- Returns:
- quotient
-
mod
Evaluates a % b- Parameters:
a- dividendb- divisor- Returns:
- modulo
-
compare
-
doArithmetic
-
urlencode
Uses URL Encoding for it's argument- Parameters:
arg- arguments- Returns:
- formatted string
- Throws:
UnsupportedEncodingException
-
defaultValue
Supports default value in case variable is null- Parameters:
arg1- the default value- Returns:
- formatted string
-
defaultValue
Supports default value in case variable is null- Parameters:
arg1- the default value (will not be used)arg2- the pipeline value (will be used)- Returns:
- formatted string
-