Java Code Examples for java.util.concurrent.atomic.AtomicInteger#longValue()

The following examples show how to use java.util.concurrent.atomic.AtomicInteger#longValue() . 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: LocalJobRunner.java    From marklogic-contentpump with Apache License 2.0 5 votes vote down vote up
public double computeProgress() {
    if (progress.length == 0) {
        return (double)1;
    }
    long result = 0;
    for (AtomicInteger pct : progress) {
        result += pct.longValue();
    }
    return (double)result / progress.length / 100;
}
 
Example 2
Source File: MetricEventPublisher.java    From chaos-monkey-spring-boot with Apache License 2.0 4 votes vote down vote up
public void publishMetricEvent(MetricType metricType, AtomicInteger atomicTimeoutGauge) {
  final long gaugeValue = (atomicTimeoutGauge == null) ? -1 : atomicTimeoutGauge.longValue();
  MetricEvent metricEvent = new MetricEvent(this, metricType, gaugeValue, null);
  publisher.publishEvent(metricEvent);
}
 
Example 3
Source File: AtomicIntegerCastExtensions.java    From sarl with Apache License 2.0 4 votes vote down vote up
/** Convert the given value to {@code AtomicLong}. This function is not null-safe.
 *
 * @param number a number of {@code AtomicInteger} 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(AtomicInteger number) {
	return new AtomicLong(number.longValue());
}
 
Example 4
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** The binary {@code multiply} 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.longValue())", constantExpression = true)
public static long operator_multiply(AtomicInteger left, Long right) {
	return left.longValue() * right.longValue();
}
 
Example 5
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** The binary {@code multiply} 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 long operator_multiply(AtomicInteger left, long right) {
	return left.longValue() * right;
}
 
Example 6
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.intValue() / $2.longValue())", constantExpression = true)
public static long operator_divide(AtomicInteger left, AtomicLong right) {
	return left.longValue() / right.longValue();
}
 
Example 7
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.intValue() / $2.longValue())", constantExpression = true)
public static long operator_divide(AtomicInteger left, Long right) {
	return left.longValue() / right.longValue();
}
 
Example 8
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.intValue() / $2)", constantExpression = true)
public static long operator_divide(AtomicInteger left, long right) {
	return left.longValue() / right;
}
 
Example 9
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.intValue() + $2.longValue())", constantExpression = true)
public static long operator_plus(AtomicInteger left, AtomicLong right) {
	return left.longValue() + right.longValue();
}
 
Example 10
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.intValue() + $2.longValue())", constantExpression = true)
public static long operator_plus(AtomicInteger left, Long right) {
	return left.longValue() + right.longValue();
}
 
Example 11
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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 long operator_modulo(AtomicInteger left, long right) {
	return left.longValue() % right;
}
 
Example 12
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.longValue())", constantExpression = true)
public static long operator_modulo(AtomicInteger left, Long right) {
	return left.longValue() % right.longValue();
}
 
Example 13
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.intValue() - $2.longValue())", constantExpression = true)
public static long operator_minus(AtomicInteger left, Long right) {
	return left.longValue() - right.longValue();
}
 
Example 14
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** 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.intValue() - $2)", constantExpression = true)
public static long operator_minus(AtomicInteger left, long right) {
	return left.longValue() - right;
}
 
Example 15
Source File: AtomicIntegerArithmeticExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** The binary {@code multiply} 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.longValue())", constantExpression = true)
public static long operator_multiply(AtomicInteger left, AtomicLong right) {
	return left.longValue() * right.longValue();
}
 
Example 16
Source File: AtomicIntegerComparisonExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/**
 * 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 17
Source File: AtomicIntegerComparisonExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** The binary {@code lessThan} 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_lessThan(AtomicInteger left, long right) {
	return left.longValue() < right;
}
 
Example 18
Source File: AtomicIntegerComparisonExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** The binary {@code greaterThan} operator. This is the equivalent
 * to the Java {@code &gt;} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&gt;right}
 */
@Pure
@Inline(value = "($1.longValue() > $2)", constantExpression = true)
public static boolean operator_greaterThan(AtomicInteger left, long right) {
	return left.longValue() > right;
}
 
Example 19
Source File: AtomicIntegerComparisonExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** The binary {@code lessEqualsThan} operator. This is the equivalent
 * to the Java {@code &lt;=} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&lt;=right}
 */
@Pure
@Inline(value = "($1.longValue() <= $2)", constantExpression = true)
public static boolean operator_lessEqualsThan(AtomicInteger left, long right) {
	return left.longValue() <= right;
}
 
Example 20
Source File: AtomicIntegerComparisonExtensions.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** The binary {@code greaterEqualsThan} operator. This is the equivalent
 * to the Java {@code &gt;=} operator. This function is not null-safe.
 *
 * @param left a number.
 * @param right a number.
 * @return {@code left&gt;=right}
 */
@Pure
@Inline(value = "($1.longValue() >= $2)", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicInteger left, long right) {
	return left.longValue() >= right;
}