public static LongBinding toLongBinding(ObservableValue<? extends Number> ov) { return new LongBinding() { { bind(ov); } @Override protected long computeValue() { return ov.getValue() == null ? 0 : ov.getValue().longValue(); } }; }
public LongBinding durationProperty() { return Bindings.createLongBinding(new Callable<Long>() { @Override public Long call() throws Exception { return getBatch().getDuration(); } }, isRunningProperty()); }
public LongBinding selectLong(Function<S, ? extends ObservableLongValue> childPropertyAccessor) { return selectLong(childPropertyAccessor, 0L); }
public LongBinding selectLong(Function<S, ? extends ObservableLongValue> childPropertyAccessor, long defaultValue) { return new LongBindingAdapter(new ChainBinding<>(rootProperty, childPropertyAccessor), defaultValue); }
public LongBinding mapToLong(Function<S, Long> childValueAccessor) { return mapToLong(childValueAccessor, 0L); }
public LongBinding mapToLong(Function<S, Long> childValueAccessor, Long defaultValue) { return new LongBindingAdapter(mapToObject(childValueAccessor), defaultValue); }
public LongBinding resultSizeProperty() { return resultSize; }
public LongBinding startIndexProperty() { return startIndex; }
protected LongBinding getModelHandle() { return Bindings.selectLong(oe.getPropertyBinding(Long.class, "CBodyComponent.m_hModel", 0L)); }
protected LongBindingAssert(LongBinding actual) { super(actual, LongBindingAssert.class); }
@Test public void testLongBinding(){ LongProperty value = new SimpleLongProperty(10l); final LongBinding actual = value.add(20l); assertThat(actual).hasValue(30l); assertThat(actual).hasSameValue(actual); }
/** * 建立包裝目前觀察值為長整數型態的繫節。 * * @param thiz 來源觀察值 * @param mapper 轉換目前觀察值為長整數型態的函數 * @return 長整數型態的繫節(依賴目前的觀察物件) */ default LongBinding asLong(Function<? super T, ? extends Long> mapper) { ObservableValue<T> thiz = (ObservableValue<T>) this; return Bindings.createLongBinding(() -> mapper.apply(thiz.getValue()), thiz); }
/** * Binding for {@link java.lang.Math#abs(long)} * * @param a the argument whose absolute value is to be determined as observableValue * @return the absolute value of the argument. */ public static LongBinding abs(final ObservableLongValue a) { return createLongBinding(() -> Math.abs(a.get()), a); }
/** * Binding for {@link java.lang.Math#addExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long * */ public static LongBinding addExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.addExact(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#addExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding addExact(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.addExact(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#addExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding addExact(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.addExact(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#decrementExact(long)} * * @param a the value to decrement * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding decrementExact(final ObservableLongValue a) { return createLongBinding(() -> Math.decrementExact(a.get()), a); }
/** * Binding for {@link java.lang.Math#floorDiv(long, long)} * * @param x the dividend * @param y the divisor * @return the largest (closest to positive infinity) * {@code long} value that is less than or equal to the algebraic quotient. * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorDiv(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorDiv(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#floorDiv(long, long)} * * @param x the dividend * @param y the divisor * @return the largest (closest to positive infinity) * {@code long} value that is less than or equal to the algebraic quotient. * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorDiv(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorDiv(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#floorDiv(long, long)} * * @param x the dividend * @param y the divisor * @return the largest (closest to positive infinity) * {@code long} value that is less than or equal to the algebraic quotient. * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorDiv(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.floorDiv(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#floorMod(long, long)} * * @param x the dividend * @param y the divisor * @return the floor modulus {@code x - (floorDiv(x, y) * y)} * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorMod(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorMod(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#floorMod(long, long)} * * @param x the dividend * @param y the divisor * @return the floor modulus {@code x - (floorDiv(x, y) * y)} * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorMod(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorMod(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#floorMod(long, long)} * * @param x the dividend * @param y the divisor * @return the floor modulus {@code x - (floorDiv(x, y) * y)} * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorMod(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.floorMod(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#incrementExact(long)} * * @param a the value to increment * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding incrementExact(final ObservableLongValue a) { return createLongBinding(() -> Math.incrementExact(a.get()), a); }
/** * Binding for {@link java.lang.Math#max(long, long)} * * @param a an argument. * @param b another argument. * @return the larger of {@code a} and {@code b}. */ public static LongBinding max(final ObservableLongValue a, final ObservableLongValue b) { return createLongBinding(() -> Math.max(a.get(), b.get()), a, b); }
/** * Binding for {@link java.lang.Math#max(long, long)} * * @param a an argument. * @param b another argument. * @return the larger of {@code a} and {@code b}. */ public static LongBinding max(final long a, final ObservableLongValue b) { return createLongBinding(() -> Math.max(a, b.get()), b); }
/** * Binding for {@link java.lang.Math#max(long, long)} * * @param a an argument. * @param b another argument. * @return the larger of {@code a} and {@code b}. */ public static LongBinding max(final ObservableLongValue a, final long b) { return createLongBinding(() -> Math.max(a.get(), b), a); }
/** * Binding for {@link java.lang.Math#min(long, long)} * * @param a an argument. * @param b another argument. * @return the smaller of {@code a} and {@code b}. */ public static LongBinding min(final ObservableLongValue a, final ObservableLongValue b) { return createLongBinding(() -> Math.min(a.get(), b.get()), a, b); }
/** * Binding for {@link java.lang.Math#min(long, long)} * * @param a an argument. * @param b another argument. * @return the smaller of {@code a} and {@code b}. */ public static LongBinding min(final long a, final ObservableLongValue b) { return createLongBinding(() -> Math.min(a, b.get()), b); }
/** * Binding for {@link java.lang.Math#min(long, long)} * * @param a an argument. * @param b another argument. * @return the smaller of {@code a} and {@code b}. */ public static LongBinding min(final ObservableLongValue a, final long b) { return createLongBinding(() -> Math.min(a.get(), b), a); }
/** * Binding for {@link java.lang.Math#multiplyExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding multiplyExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.multiplyExact(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#multiplyExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding multiplyExact(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.multiplyExact(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#multiplyExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding multiplyExact(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.multiplyExact(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#negateExact(long)} * * @param a the value to negate * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding negateExact(final ObservableLongValue a) { return createLongBinding(() -> Math.negateExact(a.get()), a); }
/** * Binding for {@link java.lang.Math#round(double)} * * @param a a floating-point value to be rounded to a * {@code long}. * @return the value of the argument rounded to the nearest * {@code long} value. */ public static LongBinding round(final ObservableDoubleValue a) { return createLongBinding(() -> Math.round(a.get()), a); }
/** * Binding for {@link java.lang.Math#subtractExact(long, long)} * * @param x the first value * @param y the second value to subtract from the first * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding subtractExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.subtractExact(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#subtractExact(long, long)} * * @param x the first value * @param y the second value to subtract from the first * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding subtractExact(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.subtractExact(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#subtractExact(long, long)} * * @param x the first value * @param y the second value to subtract from the first * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding subtractExact(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.subtractExact(x.get(), y), x); }