javafx.beans.property.SimpleLongProperty Java Examples

The following examples show how to use javafx.beans.property.SimpleLongProperty. 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: Test.java    From CPUSim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Constructor
 * creates a new Test object with input values.
 *
 * @param name name of the microinstruction.
 * @param machine the machine that the microinstruction belongs to.
 * @param register the register whose value is to be tested.
 * @param start an integer indicating the leftmost or rightmost bit to be tested.
 * @param numBits a non-negative integer indicating the number of bits to be tested.
 * @param comparison the type of comparison be done.
 * @param value the integer to be compared with the part of the register.
 * @param omission an integer indicating the size of the relative jump.
 */
public Test(String name, Machine machine,
           Register register,
           Integer start,
           Integer numBits,
           String comparison,
           Long value,
           Integer omission){
    super(name, machine);
    this.register = new SimpleObjectProperty<>(register);
    this.start = new SimpleIntegerProperty(start);
    this.numBits = new SimpleIntegerProperty(numBits);
    this.comparison = new SimpleStringProperty(comparison);
    this.value = new SimpleLongProperty(value);
    this.omission = new SimpleIntegerProperty(omission);
}
 
Example #2
Source File: MemoryViewerTableModel.java    From Noexes with GNU General Public License v3.0 6 votes vote down vote up
private StringBinding createBinding(int i) {
    SimpleLongProperty prop;
    switch(i / 4){
        case 0:
            prop = value1;
            break;
        case 1:
            prop = value2;
            break;
        case 2:
            prop = value3;
            break;
        case 3:
            prop = value4;
            break;
        default:
            throw new IllegalArgumentException(String.valueOf(i));
    }
    int rem = i % 4;
    return Bindings.createStringBinding(() -> {
        int j = (prop.intValue() >> (24 - rem * 8)) & 0xFF;
        return new String(new byte[]{formatChar(j)}, StandardCharsets.UTF_8);
    }, prop);
}
 
Example #3
Source File: FibTest.java    From ReactFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void main(String[] args) {
    int n = 40;

    FibTest eagerTest = new FibTest(n);
    LongProperty eagerResult = new SimpleLongProperty();
    eagerTest.setupFor(eagerResult);

    FibTest lazyTest = new FibTest(n);
    SuspendableVar<Number> lazyResult = Var.suspendable(Var.newSimpleVar(0L));
    lazyTest.setupFor(lazyResult);

    long t1 = System.currentTimeMillis();
    eagerTest.run();
    long t2 = System.currentTimeMillis();
    double eagerTime = (t2-t1)/1000.0;

    t1 = System.currentTimeMillis();
    Guard g = lazyResult.suspend();
    lazyTest.run();
    g.close();
    t2 = System.currentTimeMillis();
    double lazyTime = (t2-t1)/1000.0;

    System.out.println("EAGER TEST:");
    System.out.println("    fib_" + n + " = " + eagerResult.get());
    System.out.println("    result invalidations: " + eagerTest.invalidationCount);
    System.out.println("    duration: " + eagerTime + " seconds");
    System.out.println();
    System.out.println("LAZY TEST:");
    System.out.println("    fib_" + n + " = " + lazyResult.getValue());
    System.out.println("    result invalidations: " + lazyTest.invalidationCount);
    System.out.println("    duration: " + lazyTime + " seconds");
}
 
Example #4
Source File: Increment.java    From CPUSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * creates a new Increment object with input values.
 *
 * @param name name of the microinstruction.
 * @param machine the machine that the microinstruction belongs to.
 * @param register the register whose value is to be incremented.
 * @param overflowBit a condition bit.
 * @param delta the integer value what will be added to the register contents.
 */
public Increment(String name, Machine machine,
                 Register register,
                 ConditionBit overflowBit,
                 ConditionBit carryBit,
                 Long delta){
    super(name, machine);
    this.register = new SimpleObjectProperty<>(register);
    this.overflowBit = new SimpleObjectProperty<>(overflowBit);
    this.carryBit = new SimpleObjectProperty<>(carryBit);
    this.delta = new SimpleLongProperty(delta);
}
 
Example #5
Source File: ScanInfoProxy.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
public ScanInfoProxy(final ScanInfo info)
{
    id = new SimpleLongProperty(info.getId());
    name = new SimpleStringProperty(info.getName());
    created = new SimpleObjectProperty<>(info.getCreated());
    state = new SimpleObjectProperty<>(info.getState());
    percent = new SimpleIntegerProperty(info.getPercentage());
    runtime = new SimpleStringProperty(info.getRuntimeText());
    finish = new SimpleObjectProperty<>(info.getFinishTime());
    command = new SimpleStringProperty(info.getCurrentCommand());
    error = new SimpleStringProperty(info.getError().orElse(""));
    this.info = info;
}
 
Example #6
Source File: CpusimSet.java    From CPUSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * creates a new Set object with input values.
 *
 * @param name name of the microinstruction.
 * @param register the register whose bits are to be set.
 * @param machine the machine that the microinstruction belongs to.
 * @param start the leftmost or rightmost bit of the register that is to be set.
 * @param numBits the number of consecutive bits in the register to be set.
 * @param value the base-10 value to which the bits are to be set.
 */
public CpusimSet(String name, Machine machine,
                 Register register,
                 Integer start,
                 Integer numBits,
                 Long value){
    super(name, machine);
    this.register = new SimpleObjectProperty<>(register);
    this.start = new SimpleIntegerProperty(start);
    this.numBits = new SimpleIntegerProperty(numBits);
    this.value = new SimpleLongProperty(value);
}
 
Example #7
Source File: FXWrapper.java    From dolphin-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Create a JavaFX {@link javafx.beans.property.LongProperty} as a wrapper for a dolphin platform property
 *
 * @param dolphinProperty the dolphin platform property
 * @return the JavaFX property
 */
public static LongProperty wrapLongProperty(final Property<Long> dolphinProperty) {
    Assert.requireNonNull(dolphinProperty, "dolphinProperty");
    final LongProperty property = new SimpleLongProperty();
    FXBinder.bind(property).bidirectionalToNumeric(dolphinProperty);
    return property;
}
 
Example #8
Source File: Register.java    From CPUSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * @param name name of the register
 * @param width a positive integer that specifies the number of bits in the register.
 * @param initialValue the initial value stored in the register
 * @param readOnly the read only status of the register (if true, the value in
 *                 the register cannot be changed)
 * @param dirty  whether the Register's name has changed since last displayed
 */
public Register(String name, int width, long initialValue, boolean readOnly, boolean dirty)
{
    super(name);
    this.value = new SimpleLongProperty(this, "register value", 0);
    setWidth(width);
    this.initialValue = new SimpleLongProperty(initialValue);
    this.readOnly = new SimpleBooleanProperty(readOnly);
    nameDirty = dirty;
    setValue(initialValue);
}
 
Example #9
Source File: RAMLocation.java    From CPUSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * @param addr address of data
 * @param val value store in that line
 * @param ram the ram that stores the data
 * @param breakPoint tell if it's a breakPoint
 * @param comment comment from assmebled instruction
 * @param sourceLine sourceline from the assembled instruction
 */
public RAMLocation(int addr, long val, RAM ram, boolean breakPoint, String comment,
        SourceLine sourceLine){
    this.address = new SimpleLongProperty(addr);
    this.ram = ram;
    this.value = new SimpleLongProperty(val);
    this.breakPoint = new SimpleBooleanProperty(breakPoint);
    this.comment = new SimpleStringProperty(comment);
    this.sourceLine = sourceLine;
    
}
 
Example #10
Source File: MemoryViewerTableModel.java    From Noexes with GNU General Public License v3.0 5 votes vote down vote up
public MemoryViewerTableModel() {
    this.addr = new SimpleLongProperty();
    this.value1 = new SimpleLongProperty();
    this.value2 = new SimpleLongProperty();
    this.value3 = new SimpleLongProperty();
    this.value4 = new SimpleLongProperty();
    for(int i = 0; i < asciiBindings.length; i++) {
        asciiBindings[i] = createBinding(i);
    }
    set(0,0,0,0,0);
}
 
Example #11
Source File: MemoryInfoTableModel.java    From Noexes with GNU General Public License v3.0 5 votes vote down vote up
public MemoryInfoTableModel(String name, MemoryInfo info) {
    this.name = new SimpleStringProperty(name);
    this.addr = new SimpleLongProperty(info.getAddress());
    this.size = new SimpleLongProperty(info.getSize());
    this.end = Bindings.add(addr, size);
    this.type = new SimpleObjectProperty<>(info.getType());
    this.access = new SimpleIntegerProperty(info.getPerm());
}
 
Example #12
Source File: FilesRedundancyController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@Override
public boolean makeMoreParameters() {
    filesList.clear();
    redundancy.clear();
    totalChecked = 0;
    totalRedundancy = new SimpleLongProperty(0);
    currentBox.setVisible(true);
    handleButton.disableProperty().bind(totalRedundancy.isEqualTo(0));
    return super.makeMoreParameters();
}
 
Example #13
Source File: PainteraAlerts.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
private static void findMaxId(
		final DataSource<? extends IntegerType<?>, ?> source,
		final int level,
		final LongConsumer maxIdTracker,
		final AtomicBoolean cancel,
		final DoubleConsumer progressTracker) {
	final RandomAccessibleInterval<? extends IntegerType<?>> rai = source.getDataSource(0, level);
	final ReadOnlyLongWrapper totalNumVoxels = new ReadOnlyLongWrapper(Intervals.numElements(rai));
	maxIdTracker.accept(org.janelia.saalfeldlab.labels.Label.getINVALID());
	final LongProperty numProcessedVoxels = new SimpleLongProperty(0);
	numProcessedVoxels.addListener((obs, oldv, newv) -> progressTracker.accept(numProcessedVoxels.doubleValue() / totalNumVoxels.doubleValue()));

	final int[] blockSize = blockSizeFromRai(rai);
	final List<Interval> intervals = Grids.collectAllContainedIntervals(Intervals.minAsLongArray(rai), Intervals.maxAsLongArray(rai), blockSize);

	final ExecutorService es = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
	final List<Future<?>> futures = new ArrayList<>();
	for (final Interval interval : intervals) {
		futures.add(es.submit(() -> {
			synchronized (cancel) {
				if (cancel.get())
					return;
			}
			final RandomAccessibleInterval<? extends IntegerType<?>> slice = Views.interval(rai, interval);
			final long maxId = findMaxId(slice);
			synchronized (cancel) {
				if (!cancel.get()) {
					numProcessedVoxels.set(numProcessedVoxels.get() + Intervals.numElements(slice));
					maxIdTracker.accept(maxId);
				}
			}
		}));
	}
	futures.forEach(ThrowingConsumer.unchecked(Future::get));
	es.shutdown();
}
 
Example #14
Source File: FibTest.java    From ReactFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private FibTest(int n) {
    N = n;
    fib = new NumberExpression[N];
    fib[0] = new SimpleLongProperty(0);
    fib[1] = new SimpleLongProperty(0);
    for(int i = 2; i < N; ++i) {
        fib[i] = fib[i-2].add(fib[i-1]);
    }
}
 
Example #15
Source File: SimpleLongPropertySerializer.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
@Override
public SimpleLongProperty deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext
		context)
throws JsonParseException
{
	return new SimpleLongProperty(Optional.ofNullable((Long) context.deserialize(json, Long.class)).orElse(0l));
}
 
Example #16
Source File: ClockBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B animationDuration(final long DURATION) {
    properties.put("animationDuration", new SimpleLongProperty(DURATION));
    return (B)this;
}
 
Example #17
Source File: GaugeBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B animationDuration(final long DURATION) {
    properties.put("animationDuration", new SimpleLongProperty(DURATION));
    return (B)this;
}
 
Example #18
Source File: TileBuilder.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public final B animationDuration(final long DURATION) {
    properties.put("animationDuration", new SimpleLongProperty(DURATION));
    return (B)this;
}
 
Example #19
Source File: TileBuilder.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public final B timeoutMs(final long TIMEOUT_MS) {
    properties.put("timeoutMs", new SimpleLongProperty(TIMEOUT_MS));
    return (B)this;
}
 
Example #20
Source File: EQU.java    From CPUSim with GNU General Public License v3.0 4 votes vote down vote up
public EQU(String name, long value) {
    this.name = new SimpleStringProperty(name);
    this.value = new SimpleLongProperty(value);
}
 
Example #21
Source File: EQU.java    From CPUSim with GNU General Public License v3.0 4 votes vote down vote up
public SimpleLongProperty valueProperty() {
    return value;
}
 
Example #22
Source File: TraceLog.java    From erlyberly with GNU General Public License v3.0 4 votes vote down vote up
public SimpleLongProperty durationProperty() {
    return duration;
}
 
Example #23
Source File: LedBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final LedBuilder interval(final long INTERVAL) {
    properties.put("interval", new SimpleLongProperty(INTERVAL));
    return this;
}
 
Example #24
Source File: LedBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final LedBuilder interval(final long INTERVAL) {
    properties.put("interval", new SimpleLongProperty(INTERVAL));
    return this;
}
 
Example #25
Source File: LedBuilder.java    From JFX8CustomControls with Apache License 2.0 4 votes vote down vote up
public final LedBuilder interval(final long INTERVAL) {
    properties.put("interval", new SimpleLongProperty(INTERVAL));
    return this;
}
 
Example #26
Source File: LedBuilder.java    From JFX8CustomControls with Apache License 2.0 4 votes vote down vote up
public final LedBuilder interval(final long INTERVAL) {
    properties.put("interval", new SimpleLongProperty(INTERVAL));
    return this;
}
 
Example #27
Source File: ChartItemBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B animationDuration(final long DURATION) {
    properties.put("animationDuration", new SimpleLongProperty(DURATION));
    return (B)this;
}
 
Example #28
Source File: TileBuilder.java    From OEE-Designer with MIT License 4 votes vote down vote up
@SuppressWarnings("unchecked")
public final B flipTimeInMS(final long TIME) {
       properties.put("flipTimeInMS", new SimpleLongProperty(TIME));
       return (B)this;
   }
 
Example #29
Source File: SimpleLongPropertySerializer.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
@Override
public JsonElement serialize(final SimpleLongProperty src, final Type typeOfSrc, final JsonSerializationContext context)
{
	return new JsonPrimitive(src.get());
}
 
Example #30
Source File: SimpleLongPropertySerializer.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Class<SimpleLongProperty> getTargetClass() {
	return SimpleLongProperty.class;
}