下面列出了java.util.concurrent.atomic.AtomicLong#longValue() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
/**
* 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;
}
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;
}
/** 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;
}
/** 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();
}
/** 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;
}
/** 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();
}
/** 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();
}
/** 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();
}
/** 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();
}
/** 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;
}
/** 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;
}
/** 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();
}
/** 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();
}
/** 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();
}
/** 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.longValue() >= $2)", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicLong left, short right) {
return left.longValue() >= right;
}
/** 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();
}
/** 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;
}
/** 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.longValue() >= $2)", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicLong left, byte right) {
return left.longValue() >= right;
}
/** 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.longValue() >= $2)", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicLong left, int right) {
return left.longValue() >= right;
}