Java Code Examples for java.util.concurrent.atomic.AtomicInteger#doubleValue()
The following examples show how to use
java.util.concurrent.atomic.AtomicInteger#doubleValue() .
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: AtomicIntegerCastExtensions.java From sarl with Apache License 2.0 | 4 votes |
/** 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()); }
Example 2
Source File: EstimateROC.java From MHAP with Apache License 2.0 | 4 votes |
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; }
Example 3
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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; }
Example 4
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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(); }
Example 5
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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; }
Example 6
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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(); }
Example 7
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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; }
Example 8
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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(); }
Example 9
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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; }
Example 10
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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(); }
Example 11
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** * 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; }
Example 12
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** * 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(); }
Example 13
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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; }
Example 14
Source File: AtomicIntegerComparisonExtensions.java From sarl with Apache License 2.0 | 2 votes |
/** 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(); }