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

The following examples show how to use java.util.concurrent.atomic.AtomicLong#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: QLPattern.java    From QLExpress with 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 File: LeafServerUtils.java    From leafserver with 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
Source File: ProjectComparator.java    From takari-smart-builder with Apache License 2.0 4 votes vote down vote up
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
Source File: AtomicLongArithmeticExtensions.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.longValue() * $2)", constantExpression = true)
public static long operator_multiply(AtomicLong left, short right) {
	return left.longValue() * right;
}
 
Example 5
Source File: AtomicLongComparisonExtensions.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(AtomicLong left, int right) {
	return left.longValue() >= right;
}
 
Example 6
Source File: AtomicLongComparisonExtensions.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(AtomicLong left, byte right) {
	return left.longValue() >= right;
}
 
Example 7
Source File: AtomicLongArithmeticExtensions.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.longValue() - $2)", constantExpression = true)
public static double operator_minus(AtomicLong left, double right) {
	return left.longValue() - right;
}
 
Example 8
Source File: ByteArithmeticExtensions.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.byteValue() - $2.longValue())", constantExpression = true)
public static long operator_minus(Byte left, AtomicLong right) {
	return left.byteValue() - right.longValue();
}
 
Example 9
Source File: AtomicLongComparisonExtensions.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(AtomicLong left, short right) {
	return left.longValue() >= right;
}
 
Example 10
Source File: LongArithmeticExtensions.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.longValue() + $2.longValue())", constantExpression = true)
public static long operator_plus(Long left, AtomicLong right) {
	return left.longValue() + right.longValue();
}
 
Example 11
Source File: ShortArithmeticExtensions.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.shortValue() / $2.longValue())", constantExpression = true)
public static long operator_divide(Short left, AtomicLong right) {
	return left.shortValue() / right.longValue();
}
 
Example 12
Source File: AtomicLongArithmeticExtensions.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.longValue() % $2.longValue())", constantExpression = true)
public static long operator_modulo(AtomicLong left, Long right) {
	return left.longValue() % right.longValue();
}
 
Example 13
Source File: AtomicLongArithmeticExtensions.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.longValue() * $2)", constantExpression = true)
public static long operator_multiply(AtomicLong left, long right) {
	return left.longValue() * right;
}
 
Example 14
Source File: LongArithmeticExtensions.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.longValue() % $2.longValue())", constantExpression = true)
public static long operator_modulo(Long left, AtomicLong right) {
	return left.longValue() % right.longValue();
}
 
Example 15
Source File: PrimitiveIntArithmeticExtensions.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 / $2.longValue())", constantExpression = true)
public static long operator_divide(int left, AtomicLong right) {
	return left / right.longValue();
}
 
Example 16
Source File: AtomicLongArithmeticExtensions.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.longValue() / $2.intValue())", constantExpression = true)
public static long operator_divide(AtomicLong left, AtomicInteger right) {
	return left.longValue() / right.intValue();
}
 
Example 17
Source File: AtomicLongArithmeticExtensions.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.longValue() * $2.longValue())", constantExpression = true)
public static long operator_multiply(AtomicLong left, AtomicLong right) {
	return left.longValue() * right.longValue();
}
 
Example 18
Source File: AtomicLongArithmeticExtensions.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.longValue() - $2)", constantExpression = true)
public static long operator_minus(AtomicLong left, byte right) {
	return left.longValue() - right;
}
 
Example 19
Source File: PrimitiveFloatArithmeticExtensions.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 - $2.longValue())", constantExpression = true)
public static float operator_minus(float left, AtomicLong right) {
	return left - right.longValue();
}
 
Example 20
Source File: AtomicLongArithmeticExtensions.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.longValue() + $2)", constantExpression = true)
public static long operator_plus(AtomicLong left, int right) {
	return left.longValue() + right;
}