Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.H4kt.SimpleFramework.utils;
- public class ColorInteger {
- private double value = 0;
- public ColorInteger() {}
- public ColorInteger(int value) {
- this.value = value;
- }
- public void increase(double amount) {
- value += amount;
- this.checkBounds();
- }
- public void decrease(double amount) {
- value -= amount;
- this.checkBounds();
- }
- private void checkBounds() {
- if (value>255) value = 255;
- if (value<0) value = 0;
- }
- public int increaseAndGet(double amount) {
- this.increase(amount);
- return Utils.round(value);
- }
- public int decreaseAndGet(double amount) {
- this.decrease(amount);
- return Utils.round(value);
- }
- public int get() {
- return Utils.round(value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement