org.eclipse.xtext.xbase.lib.Inline Java Examples
The following examples show how to use
org.eclipse.xtext.xbase.lib.Inline.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AtomicIntegerCastExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert the given value to {@code AtomicDouble}. This function is not null-safe. * * @param number a number of {@code AtomicInteger} type. * @return the equivalent value to {@code number} of {@code AtomicDouble} type. */ @Pure @Inline(value = "new $2($1.doubleValue())", imported = AtomicDouble.class) public static AtomicDouble toAtomicDouble(AtomicInteger number) { return new AtomicDouble(number.doubleValue()); }
Example #2
Source File: NumberCastExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert the given value to {@code AtomicLong}. This function is not null-safe. * * @param number a number of {@code Byte} type. * @return the equivalent value to {@code number} of {@code AtomicLong} type. */ @Pure @Inline(value = "new $2($1.longValue())", imported = AtomicLong.class) public static AtomicLong toAtomicLong(Number number) { return new AtomicLong(number.longValue()); }
Example #3
Source File: TimeExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert minutes to milliseconds. * * @param mins number of minutes to convert. * @return the number of milliseconds in <code>mins</code> */ @Pure @Inline(value = "(long) (($1) * $2.MILLIS_IN_MINUTE)", imported = {TimeExtensions.class}) public static long minutes(double mins) { return (long) (mins * MILLIS_IN_MINUTE); }
Example #4
Source File: PrimitiveFloatCastExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert the given value to {@code Integer}. * * @param number a number of {@code float} type. * @return the equivalent value to {@code number} of {@code Integer} type. */ @Pure @Inline(value = "$2.valueOf(($3) $1)", imported = {Short.class, short.class}) public static Short toShort(float number) { return Short.valueOf((short) number); }
Example #5
Source File: TimeExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert seconds to milliseconds. * * @param secs number of seconds to convert. * @return the number of milliseconds in seconds. */ @Pure @Inline(value = "($1) * $2.MILLIS_IN_SECOND", imported = {TimeExtensions.class}) public static long seconds(long secs) { return secs * MILLIS_IN_SECOND; }
Example #6
Source File: TimeExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert seconds to milliseconds. * * @param secs number of seconds to convert. * @return the number of milliseconds in seconds. */ @Pure @Inline(value = "(long) (($1) * $2.MILLIS_IN_SECOND)", imported = {TimeExtensions.class}) public static long seconds(double secs) { return (long) (secs * MILLIS_IN_SECOND); }
Example #7
Source File: TimeExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert milliseconds to milliseconds. * * @param milis number of milliseconds to convert. * @return the number of milliseconds in <code>milis</code>. */ @Pure @Inline(value = "(long) ($1)") public static long milliseconds(byte milis) { return milis; }
Example #8
Source File: AtomicLongCastExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** Convert the given value to {@code Long}. This function is not null-safe. * * @param number a number of {@code AtomicLong} type. * @return the equivalent value to {@code number} of {@code Long} type. */ @Pure @Inline(value = "$2.valueOf($1.longValue())", imported = Long.class) public static Long toLong(AtomicLong number) { return number.longValue(); }
Example #9
Source File: DoubleComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code notEquals} operator. This is the equivalent * to the Java {@code !=} operator. This function is null-safe. * * @param left a number. * @param right a number. * @return {@code left!=right} */ @Pure @Inline(value = "($1 == null || ($1.doubleValue() != $2))", constantExpression = true) public static boolean operator_notEquals(Double left, double right) { return left != null && left.doubleValue() != right; }
Example #10
Source File: PrimitiveLongArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code divide} operator. This is the equivalent to * the Java {@code /} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left/right} */ @Pure @Inline(value = "($1 / $2.doubleValue())", constantExpression = true) public static double operator_divide(long left, Number right) { return left / right.doubleValue(); }
Example #11
Source File: ShortComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code lessEqualsThan} operator. This is the equivalent * to the Java {@code <=} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left<=right} */ @Pure @Inline(value = "($1.shortValue() <= $2.doubleValue())", constantExpression = true) public static boolean operator_lessEqualsThan(Short left, Number right) { return left.shortValue() <= right.doubleValue(); }
Example #12
Source File: PrimitiveByteComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** * The binary {@code equals} operator. This is the equivalent to the Java {@code ==} operator. * This function is null-safe. * * @param left a number. * @param right a number. * @return {@code left==right} */ @Pure @Inline(value = "($2 != null && $1 == $2.doubleValue())", constantExpression = true) public static boolean operator_equals(byte left, Number right) { return right != null && left == right.doubleValue(); }
Example #13
Source File: ShortArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code divide} operator. This is the equivalent to * the Java {@code /} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left/right} */ @Pure @Inline(value = "($1.shortValue() / $2)", constantExpression = true) public static int operator_divide(Short left, byte right) { return left.shortValue() / right; }
Example #14
Source File: ByteComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code lessEqualsThan} operator. This is the equivalent * to the Java {@code <=} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left<=right} */ @Pure @Inline(value = "($1.byteValue() <= $2)", constantExpression = true) public static boolean operator_lessEqualsThan(Byte left, long right) { return left.byteValue() <= right; }
Example #15
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** * The binary {@code equals} operator. This is the equivalent to the Java {@code ==} operator. * This function is null-safe. * * @param left a number. * @param right a number. * @return {@code left==right} */ @Pure @Inline(value = "($1 != null ? ($1.longValue() == $2) : false)", constantExpression = true) public static boolean operator_equals(AtomicInteger left, long right) { return left != null ? left.longValue() == right : false; }
Example #16
Source File: IntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The number comparison operator. This is equivalent to the Java * {@code compareTo} function on numbers. This function is null-safe. * * @param left a number * @param right a number. * @return the value {@code 0} if {@code left == right}; * a value less than {@code 0} if {@code left < right}; and * a value greater than {@code 0} if {@code left > right}. */ @Pure @Inline(value = "$3.compare($1.intValue(), $2)", constantExpression = true, imported = Float.class) public static int operator_spaceship(Integer left, float right) { return Float.compare(left.intValue(), right); }
Example #17
Source File: ShortArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code minus} operator. This is the equivalent to * the Java {@code -} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left-right} */ @Pure @Inline(value = "($1.shortValue() - $2)", constantExpression = true) public static int operator_minus(Short left, short right) { return left.shortValue() - right; }
Example #18
Source File: IntegerArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code modulo} operator. This is the equivalent to * the Java {@code %} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left%right} */ @Pure @Inline(value = "($1.intValue() % $2)", constantExpression = true) public static double operator_modulo(Integer left, double right) { return left.intValue() % right; }
Example #19
Source File: NumberComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code lessEqualsThan} operator. This is the equivalent * to the Java {@code <=} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left<=right} */ @Pure @Inline(value = "($1.doubleValue() <= $2)", constantExpression = true) public static boolean operator_lessEqualsThan(Number left, byte right) { return left.doubleValue() <= right; }
Example #20
Source File: ByteArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code modulo} operator. This is the equivalent to * the Java {@code %} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left%right} */ @Pure @Inline(value = "($1.byteValue() % $2)", constantExpression = true) public static int operator_modulo(Byte left, short right) { return left.byteValue() % right; }
Example #21
Source File: FloatComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code greaterEqualsThan} operator. This is the equivalent * to the Java {@code >=} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left>=right} */ @Pure @Inline(value = "($1.floatValue() >= $2)", constantExpression = true) public static boolean operator_greaterEqualsThan(Float left, float right) { return left.floatValue() >= right; }
Example #22
Source File: ByteComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code greaterEqualsThan} operator. This is the equivalent * to the Java {@code >=} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left>=right} */ @Pure @Inline(value = "($1.byteValue() >= $2)", constantExpression = true) public static boolean operator_greaterEqualsThan(Byte left, byte right) { return left.byteValue() >= right; }
Example #23
Source File: PrimitiveByteArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code modulo} operator. This is the equivalent to * the Java {@code %} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left%right} */ @Pure @Inline(value = "($1 % $2.doubleValue())", constantExpression = true) public static double operator_modulo(byte left, Number right) { return left % right.doubleValue(); }
Example #24
Source File: ByteArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code minus} operator. This is the equivalent to * the Java {@code -} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left-right} */ @Pure @Inline(value = "($1.byteValue() - $2.longValue())", constantExpression = true) public static long operator_minus(Byte left, Long right) { return left.byteValue() - right.longValue(); }
Example #25
Source File: AtomicLongComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code greaterThan} operator. This is the equivalent * to the Java {@code >} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left>right} */ @Pure @Inline(value = "($1.longValue() > $2)", constantExpression = true) public static boolean operator_greaterThan(AtomicLong left, long right) { return left.longValue() > right; }
Example #26
Source File: PrimitiveLongArithmeticExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code plus} operator. This is the equivalent to * the Java {@code +} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left+right} */ @Pure @Inline(value = "($1 + $2.doubleValue())", constantExpression = true) public static double operator_plus(long left, Number right) { return left + right.doubleValue(); }
Example #27
Source File: PrimitiveIntComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The number comparison operator. This is equivalent to the Java * {@code compareTo} function on numbers. This function is null-safe. * * @param left a number * @param right a number. * @return the value {@code 0} if {@code left == right}; * a value less than {@code 0} if {@code left < right}; and * a value greater than {@code 0} if {@code left > right}. */ @Pure @Inline(value = "$3.compare($1, $2.doubleValue())", constantExpression = true, imported = Double.class) public static int operator_spaceship(int left, Double right) { return Double.compare(left, right.doubleValue()); }
Example #28
Source File: PrimitiveShortComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The number comparison operator. This is equivalent to the Java * {@code compareTo} function on numbers. This function is null-safe. * * @param left a number * @param right a number. * @return the value {@code 0} if {@code left == right}; * a value less than {@code 0} if {@code left < right}; and * a value greater than {@code 0} if {@code left > right}. */ @Pure @Inline(value = "$3.compare($1, $2.intValue())", constantExpression = true, imported = Integer.class) public static int operator_spaceship(short left, AtomicInteger right) { return Integer.compare(left, right.intValue()); }
Example #29
Source File: LongComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The number comparison operator. This is equivalent to the Java * {@code compareTo} function on numbers. This function is null-safe. * * @param left a number * @param right a number. * @return the value {@code 0} if {@code left == right}; * a value less than {@code 0} if {@code left < right}; and * a value greater than {@code 0} if {@code left > right}. */ @Pure @Inline(value = "$3.compare($1.longValue(), $2)", constantExpression = true, imported = Long.class) public static int operator_spaceship(Long left, short right) { return Long.compare(left.longValue(), right); }
Example #30
Source File: FloatComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** The binary {@code greaterThan} operator. This is the equivalent * to the Java {@code >} operator. This function is not null-safe. * * @param left a number. * @param right a number. * @return {@code left>right} */ @Pure @Inline(value = "($1.floatValue() > $2)", constantExpression = true) public static boolean operator_greaterThan(Float left, short right) { return left.floatValue() > right; }