下面列出了java.util.concurrent.atomic.AtomicInteger#doubleValue() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/** 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());
}
private void estimatePPV() throws InterruptedException, ExecutionException {
AtomicInteger numTP = new AtomicInteger();
ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors());
forkJoinPool.submit(() ->
Stream.iterate(0, i->i+1).limit(this.numTrials).parallel().forEach(i-> {
int ovlLen = 0;
String[] ovl = null;
String ovlName = null;
while (ovlLen < this.minOvlLen) {
// pick an overlap
ovlName = pickRandomMatch();
Overlap o = this.ovlInfo.get(ovlName);
ovlLen = Utils.getRangeOverlap(o.afirst, o.asecond, o.bfirst, o.bsecond);
}
if (ovlName == null) {
System.err.println("Could not find any computed overlaps > " + this.minOvlLen);
System.exit(1);
} else {
ovl = ovlName.split("_");
String id = ovl[0];
String id2 = ovl[1];
HashSet<String> matches = getSequenceMatches(id, 0);
if (matches != null && matches.contains(id2)) {
numTP.getAndIncrement();
} else {
if (computeDP(id, id2)) {
numTP.getAndIncrement();
} else {
if (DEBUG) { System.err.println("Overlap between sequences: " + id + ", " + id2 + " is not correct."); }
}
}
}
})
).get();
// now our formula for PPV. Estimate percent of our matches which are true
this.ppv = numTP.doubleValue() / (double)this.numTrials;
}
/** 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.doubleValue() >= $2)", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicInteger left, double right) {
return left.doubleValue() >= 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.doubleValue() >= $2.doubleValue())", constantExpression = true)
public static boolean operator_greaterEqualsThan(AtomicInteger left, Number right) {
return left.doubleValue() >= right.doubleValue();
}
/** 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(AtomicInteger left, double right) {
return left.doubleValue() <= right;
}
/** 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.doubleValue())", constantExpression = true)
public static boolean operator_lessEqualsThan(AtomicInteger left, Number right) {
return left.doubleValue() <= right.doubleValue();
}
/** 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.doubleValue() > $2)", constantExpression = true)
public static boolean operator_greaterThan(AtomicInteger left, double right) {
return left.doubleValue() > right;
}
/** 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.doubleValue() > $2.doubleValue())", constantExpression = true)
public static boolean operator_greaterThan(AtomicInteger left, Number right) {
return left.doubleValue() > right.doubleValue();
}
/** 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.doubleValue() < $2)", constantExpression = true)
public static boolean operator_lessThan(AtomicInteger left, double right) {
return left.doubleValue() < right;
}
/** 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.doubleValue() < $2.doubleValue())", constantExpression = true)
public static boolean operator_lessThan(AtomicInteger left, Number right) {
return left.doubleValue() < right.doubleValue();
}
/**
* 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.doubleValue() == $2) : false)", constantExpression = true)
public static boolean operator_equals(AtomicInteger left, double right) {
return left != null ? left.doubleValue() == right : false;
}
/**
* 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 ? ($2 == null) : ($2 != null && $1.doubleValue() == $2.doubleValue()))", constantExpression = true)
public static boolean operator_equals(AtomicInteger left, Number right) {
return left == null ? right == null : right != null && left.doubleValue() == right.doubleValue();
}
/** 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 ? false : ($1.doubleValue() != $2))", constantExpression = true)
public static boolean operator_notEquals(AtomicInteger left, double right) {
return left == null ? false : left.doubleValue() != right;
}
/** 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 ? ($2 != null) : ($2 == null || $1.doubleValue() != $2.doubleValue()))", constantExpression = true)
public static boolean operator_notEquals(AtomicInteger left, Number right) {
return left == null ? right != null : right == null || left.doubleValue() != right.doubleValue();
}