aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/resources/parameters/DoubleParameter.java
blob: 8464c83a22dbbf7ea47849647df21a8a0d120c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package jcgp.backend.resources.parameters;

import javafx.beans.property.SimpleDoubleProperty;

public abstract class DoubleParameter extends Parameter {
	
	protected SimpleDoubleProperty value;
		
	public DoubleParameter(double value, String name, boolean monitor, boolean critical) {
		super(name, monitor, critical);
		this.value = new SimpleDoubleProperty(value);
	}
	
	public DoubleParameter(double value, String name) {
		super(name, false, false);
		this.value = new SimpleDoubleProperty(value);
	}

	public double get() {
		return value.get();
	}
	
	public void set(double newValue) {
		if (!value.isBound()) {
			value.set(newValue);
		}
	}
	
	@Override
	public SimpleDoubleProperty valueProperty() {
		return value;
	}
	
	public abstract void validate(double newValue);
	
}