All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ctreber.aclib.gui.MODouble Maven / Gradle / Ivy

Go to download

PlantUML is a component that allows to quickly write : * sequence diagram, * use case diagram, * class diagram, * activity diagram, * component diagram, * state diagram * object diagram

The newest version!
package com.ctreber.aclib.gui;

/**
 * 

* *

© 2002 Christian Treber, [email protected]

* @author Christian Treber, [email protected] * */ public class MODouble extends MonitoredObject { private double fDouble; private boolean fCheckRange = false; private double fMin; private double fMax; public MODouble() { } public MODouble(double pDouble) { fDouble = pDouble; } public MODouble(double pDouble, double pMin, double pMax) { fMin = pMin; fMax = pMax; fCheckRange = true; set(pDouble); } public void set(double pDouble) { if(!checkRange(pDouble)) { throw new IllegalArgumentException("Argument '" + pDouble + "' out of range [" + niceFormat(fMin) + "; " + niceFormat(fMax) + "]"); } fDouble = pDouble; fireValueChanged(); } private static String niceFormat(double pDouble) { if(pDouble == Double.MAX_VALUE) { return "Infinity"; } if(pDouble == Double.MIN_VALUE) { return "-Infinity"; } return Double.toString(pDouble); } public double get() { return fDouble; } private boolean checkRange(double pDouble) { return !fCheckRange || (fMin <= pDouble) && (pDouble <= fMax); } public boolean checkRange() { return checkRange(fDouble); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy