Class BuiltinsFuncs

java.lang.Object
ru.proninyaroslav.template.BuiltinsFuncs

public class BuiltinsFuncs extends Object
  • 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 value
      stop - 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 value
      stop - stop value
      step - step value
      Returns:
      number sequence
    • index

      public static Object index(Object arr, Object... indexes)
      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 - array
      indexes - indexes
      Returns:
      object or value
    • print

      public static String print(Object... args)
      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

      public static String println(Object... args)
      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

      public static boolean equal(Object arg1, Object... arg2)
      Evaluates the comparison a == b || a == c || ...
      Parameters:
      arg1 - first value
      arg2 - second value
      Returns:
      comparison result
    • notEqual

      public static boolean notEqual(Object a, Object b)
      Evaluates the comparison a != b
      Parameters:
      a - first value
      b - second value
      Returns:
      comparison result
    • lessThan

      public static boolean lessThan(Object a, Object b)
      Evaluates the comparison a < b
      Parameters:
      a - first value
      b - second value
      Returns:
      comparison result
    • lessThanOrEqual

      public static boolean lessThanOrEqual(Object a, Object b)
      Evaluates the comparison a <= b
      Parameters:
      a - first value
      b - second value
      Returns:
      comparison result
    • greaterThan

      public static boolean greaterThan(Object a, Object b)
      Evaluates the comparison a > b
      Parameters:
      a - first value
      b - second value
      Returns:
      comparison result
    • greaterThanOrEqual

      public static boolean greaterThanOrEqual(Object a, Object b)
      Evaluates the comparison a >= b
      Parameters:
      a - first value
      b - second value
      Returns:
      comparison result
    • not

      public static boolean not(Object a)
      Returns the boolean negation of its argument
      Parameters:
      a - value
      Returns:
      inversion result
    • and

      public static Object and(Object arg0, Object... args)
      Computes the boolean AND of its arguments, returning the first false argument it encounters, or the last argument
      Parameters:
      arg0 - first argument
      args - other arguments
      Returns:
      false argument
    • or

      public static Object or(Object arg0, Object... args)
      Computes the boolean OR of its arguments, returning the first true argument it encounters, or the last argument
      Parameters:
      arg0 - first argument
      args - other arguments
      Returns:
      true argument
    • add

      public static Object add(Object a, Object b)
      Evaluates a + b
      Parameters:
      a - first summand
      b - second summand
      Returns:
      sum
    • sub

      public static Object sub(Object a, Object b)
      Evaluates a - b
      Parameters:
      a - minuend
      b - subtrahend
      Returns:
      difference
    • mul

      public static Object mul(Object a, Object b)
      Evaluates a * b
      Parameters:
      a - multiplicands
      b - multiplier
      Returns:
      product
    • div

      public static Object div(Object a, Object b)
      Evaluates a / b
      Parameters:
      a - dividend
      b - divisor
      Returns:
      quotient
    • mod

      public static Object mod(Object a, Object b)
      Evaluates a % b
      Parameters:
      a - dividend
      b - divisor
      Returns:
      modulo
    • compare

      public static boolean compare(Object a, Object b, String op)
    • doArithmetic

      public static Object doArithmetic(Object a, Object b, char op)