|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpmlib.PMLRange
public class PMLRange
PMLRange Class
The PMLRange object allows the storage of upper and lower range values, alongside an identifier tag. The class provides limit, normalise and scale functionality.
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
Constructor Summary | |
---|---|
PMLRange(float a,
float b)
Create a new object instance with the specified minimum and maximum values |
|
PMLRange(int a,
int b)
Create a new object instance with the specified minimum and maximum values |
|
PMLRange(java.lang.String t,
float a,
float b)
Create a new object instance with the specified tag, minimum and maximum values |
|
PMLRange(java.lang.String t,
int a,
int b)
Create a new object instance with the specified tag, minimum and maximum values |
Method Summary | |
---|---|
boolean |
hasTag(java.lang.String t)
Return true if the stored tag matches that specified |
float |
limit(float v)
Limit the specified value to the range of this object |
static float |
limit(float v,
float a,
float b)
Limit the specified value to the specified range |
int |
limit(int v)
Limit the specified value to the range of this object |
float |
max()
Return the stored maximum value |
float |
min()
Return the stored minimum value |
float |
normalise(float v)
Normalise the specified value based on the range of this object |
static float |
normalise(float v,
float a,
float b)
Normalise the specified value based on the specified range |
float |
normalise(int v)
Normalise the specified value based on the range of this object |
float |
scale(float v)
Scale the specified value to the range of this object |
static float |
scale(float v,
float a,
float b)
Scale the specified value to the specified range |
java.lang.String |
tag()
Return the stored tag string |
java.lang.String |
toString()
Return the contents of this object as a String |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PMLRange(int a, int b)
a
- minimumb
- maximumpublic PMLRange(float a, float b)
a
- minimumb
- maximumpublic PMLRange(java.lang.String t, int a, int b)
t
- taga
- minimumb
- maximumpublic PMLRange(java.lang.String t, float a, float b)
t
- taga
- minimumb
- maximumMethod Detail |
---|
public float min()
public float max()
public java.lang.String tag()
public boolean hasTag(java.lang.String t)
t
- tag
public int limit(int v)
The returned value will be rounded to the nearest integer value.
v
- value
public float limit(float v)
v
- value
public static float limit(float v, float a, float b)
v
- valuea
- minimumb
- maximum
public float normalise(int v)
v
- value
public float normalise(float v)
v
- value
public static float normalise(float v, float a, float b)
v
- valuea
- minimumb
- maximum
public float scale(float v)
v
- value (0.0 - 1.0)
public static float scale(float v, float a, float b)
v
- value (0.0 - 1.0)a
- minimumb
- maximum
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |