~thedsweb/yawls/gui-testing

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
package com.blogspot.thedsweb.engine;

import com.blogspot.thedsweb.util.Config;

public class Threshold {
	private double darkeningThresholdValue;
	private double brighteningThresholdValue;
	
	public Threshold(Config config) {
		double darkeningThresholdPercentage = config.darkeningThreshold();
		double brighteningThresholdPercentage = config.brighteningThreshold();
		darkeningThresholdValue = (100-darkeningThresholdPercentage)/100;
		brighteningThresholdValue = (brighteningThresholdPercentage/100)+1;
	}
	
	public int getDarkeningThreshold(int x) {
		double value = x*darkeningThresholdValue;
		return (int)value;
	}

	public int getBrighteningThreshold(int x) {
		double value = x*brighteningThresholdValue;
		return (int)value;
	}
}