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

The following examples show how to use java.util.concurrent.atomic.AtomicLong#longValue() . These examples are extracted from open source projects. 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 Project: QLExpress   File: QLPattern.java    License: Apache License 2.0 6 votes vote down vote up
public static QLMatchResult findMatchStatement(INodeTypeManager aManager,QLPatternNode pattern ,List<? extends IDataNode> nodes,int point) throws Exception{
	AtomicLong maxMatchPoint = new AtomicLong();
	AtomicLong maxDeep = new AtomicLong(1);
	QLMatchResultCache resultCache =new QLMatchResultCache(5);
	ArrayListCache<QLMatchResultTree> arrayListCache = new ArrayListCache<QLMatchResultTree>(50);
       MatchParamsPack staticParams = new MatchParamsPack(aManager, nodes, maxDeep, maxMatchPoint,resultCache,arrayListCache);
	QLMatchResult result  = findMatchStatementWithAddRootOptimizeStack(staticParams, pattern, point, true, 1);
	if(printStackDepth) {
           log.warn("递归堆栈深度:" + maxDeep.longValue() + "  重用QLMatchResult次数:" + resultCache.fetchCount
				+ "  新建QLMatchResult次数:" + resultCache.newCount + "  新建ArrayList数量:" + arrayListCache.newCount);

       }
	if(result == null || result.getMatchSize() == 0){
		throw new QLCompileException("程序错误,不满足语法规范,没有匹配到合适的语法,最大匹配致[0:" + (maxMatchPoint.longValue()-1) +"]");
	}else if(result != null && result.getMatchSize() != 1){
		throw new QLCompileException("程序错误,不满足语法规范,必须有一个根节点:" + pattern + ",最大匹配致[0:" + (maxMatchPoint.longValue()-1) +"]");
	}
	return result;
}
 
Example 2
Source Project: leafserver   File: LeafServerUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * get next id when segment have it
 *
 * @param segment
 * @return nextId
 */
public static Long getSegmentId(Segment segment) {
    AtomicLong current = segment.getLongFactory();
    if (current.longValue() <= segment.getMax()) {
        return current.getAndIncrement();
    }

    segment.setInitCompleted(false);//to false

    return null;
}
 
Example 3
private static <K> Long getServiceTime(Map<String, AtomicLong> serviceTimes, K project,
    long defaultServiceTime, Function<K, String> toKey) {
  AtomicLong serviceTime = serviceTimes.get(toKey.apply(project));
  return serviceTime != null ? serviceTime.longValue() : defaultServiceTime;
}
 
Example 4
/** 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.longValue() + $2)", constantExpression = true)
public static long operator_plus(AtomicLong left, int right) {
	return left.longValue() + right;
}
 
Example 5
/** 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 - $2.longValue())", constantExpression = true)
public static float operator_minus(float left, AtomicLong right) {
	return left - right.longValue();
}
 
Example 6
/** 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.longValue() - $2)", constantExpression = true)
public static long operator_minus(AtomicLong left, byte right) {
	return left.longValue() - right;
}
 
Example 7
/** 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.longValue() * $2.longValue())", constantExpression = true)
public static long operator_multiply(AtomicLong left, AtomicLong right) {
	return left.longValue() * right.longValue();
}
 
Example 8
/** 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.longValue() / $2.intValue())", constantExpression = true)
public static long operator_divide(AtomicLong left, AtomicInteger right) {
	return left.longValue() / right.intValue();
}
 
Example 9
/** 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.longValue())", constantExpression = true)
public static long operator_divide(int left, AtomicLong right) {
	return left / right.longValue();
}
 
Example 10
Source Project: sarl   File: LongArithmeticExtensions.java    License: 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.longValue() % $2.longValue())", constantExpression = true)
public static long operator_modulo(Long left, AtomicLong right) {
	return left.longValue() % right.longValue();
}
 
Example 11
/** 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.longValue() * $2)", constantExpression = true)
public static long operator_multiply(AtomicLong left, long right) {
	return left.longValue() * right;
}
 
Example 12
/** 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.longValue() * $2)", constantExpression = true)
public static long operator_multiply(AtomicLong left, short right) {
	return left.longValue() * right;
}
 
Example 13
/** 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.longValue() % $2.longValue())", constantExpression = true)
public static long operator_modulo(AtomicLong left, Long right) {
	return left.longValue() % right.longValue();
}
 
Example 14
Source Project: sarl   File: ShortArithmeticExtensions.java    License: 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.shortValue() / $2.longValue())", constantExpression = true)
public static long operator_divide(Short left, AtomicLong right) {
	return left.shortValue() / right.longValue();
}
 
Example 15
Source Project: sarl   File: LongArithmeticExtensions.java    License: 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.longValue() + $2.longValue())", constantExpression = true)
public static long operator_plus(Long left, AtomicLong right) {
	return left.longValue() + right.longValue();
}
 
Example 16
/** 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(AtomicLong left, short right) {
	return left.longValue() >= right;
}
 
Example 17
Source Project: sarl   File: ByteArithmeticExtensions.java    License: 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.byteValue() - $2.longValue())", constantExpression = true)
public static long operator_minus(Byte left, AtomicLong right) {
	return left.byteValue() - right.longValue();
}
 
Example 18
/** 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.longValue() - $2)", constantExpression = true)
public static double operator_minus(AtomicLong left, double right) {
	return left.longValue() - right;
}
 
Example 19
/** 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(AtomicLong left, byte right) {
	return left.longValue() >= right;
}
 
Example 20
/** 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(AtomicLong left, int right) {
	return left.longValue() >= right;
}