~thedsweb/yawls/gui-testing

« back to all changes in this revision

Viewing changes to src/com/blogspot/thedsweb/engine/Threshold.java

  • Committer: Dominik Brämer
  • Date: 2015-01-26 13:14:50 UTC
  • Revision ID: thedsweb@googlemail.com-20150126131450-52rdfrak40f4pfgx
initial push

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.blogspot.thedsweb.engine;
 
2
 
 
3
import com.blogspot.thedsweb.util.Config;
 
4
 
 
5
public class Threshold {
 
6
        private double darkeningThresholdValue;
 
7
        private double brighteningThresholdValue;
 
8
        
 
9
        public Threshold(Config config) {
 
10
                double darkeningThresholdPercentage = config.darkeningThreshold();
 
11
                double brighteningThresholdPercentage = config.brighteningThreshold();
 
12
                darkeningThresholdValue = (100-darkeningThresholdPercentage)/100;
 
13
                brighteningThresholdValue = (brighteningThresholdPercentage/100)+1;
 
14
        }
 
15
        
 
16
        public int getDarkeningThreshold(int x) {
 
17
                double value = x*darkeningThresholdValue;
 
18
                return (int)value;
 
19
        }
 
20
 
 
21
        public int getBrighteningThreshold(int x) {
 
22
                double value = x*brighteningThresholdValue;
 
23
                return (int)value;
 
24
        }
 
25
}