|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cip4.jdflib.datatypes.JDFRange
org.cip4.jdflib.datatypes.JDFNumberRange
public class JDFNumberRange
This class represents a number range (JDFNumberRange). It is a whitespace separated list of 2 double values separated by a tilde "~", for example "1.23 ~ 1.45"
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes |
|---|
JDFBaseDataTypes.EnumFitsValue |
| Field Summary |
|---|
| Fields inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes |
|---|
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION |
| Constructor Summary | |
|---|---|
JDFNumberRange()
constructs an empty JDFNumberRange |
|
JDFNumberRange(double x)
constructs a JDFNumberRange, both values are equal ("from x to x") |
|
JDFNumberRange(double xmin,
double xmax)
constructor, creates a JDFNumberRange bounded by two double values ("from xmin to xmax") |
|
JDFNumberRange(JDFNumberRange nr)
copy constructor, creates a JDFNumberRange with the given JDFNumberRange |
|
JDFNumberRange(String s)
constructs a JDFNumberRange with the values of the given string |
|
| Method Summary | |
|---|---|
static JDFNumberRange |
createNumberRange(String s)
factory for JDFNumberRange that silently returns null in case of illegal strings |
boolean |
equals(Object other)
equals - returns true if both JDFNumberRange are equal otherwise false, the difference must be smaller than EPSILON |
double |
getLeft()
getLeft - returns the left value of the range |
protected Object |
getLeftObject()
|
String |
getLeftString()
returns the string representation of the left value of the range |
double |
getLowerValue()
getLowerValue - returns the lower value of the bounds for example 4.5~6.3 returns 4.5, 7.0~5.9 returns 5.9 |
double |
getRight()
getRight - returns the right value of the range |
protected Object |
getRightObject()
|
String |
getRightString()
returns the string representation of the left value of the range |
String |
getString(int precision)
get a string with precision digits after each decimal |
double |
getUpperValue()
getUpperValue - return the upper value of the bounds for example 4.5~6.3 returns 6.3, 7.0~5.9 returns 7.0 |
int |
hashCode()
hashCode complements equals() to fulfill the equals/hashCode contract |
protected void |
init(double xmin,
double xmax)
Initialization |
protected boolean |
inObjectRange(Object other)
|
boolean |
inRange(double x)
inRange - returns true if (lower value >= x <= upper value) |
boolean |
isPartOfRange(JDFRange ra)
isPartOfRange - is range 'r' within this range? |
boolean |
isValid(String s)
isValid - validate the given String |
void |
scale(double f)
scale - scales both values |
void |
setLeft(double x)
setLeft - sets the left double object |
void |
setRight(double x)
setRight - sets the right double object |
String |
toString()
toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JDFNumberRange()
public JDFNumberRange(double x)
x - the given double
public JDFNumberRange(double xmin,
double xmax)
xmin - the given min valuexmax - the given max valuepublic JDFNumberRange(JDFNumberRange nr)
nr -
public JDFNumberRange(String s)
throws DataFormatException
s - the given string
DataFormatException - - if the String has not a valid format| Method Detail |
|---|
public static JDFNumberRange createNumberRange(String s)
s - the string to parse
protected void init(double xmin,
double xmax)
xmin - left valuexmax - right valuepublic String toString()
toString in class Objectpublic boolean isValid(String s)
s - the given string to validate
public boolean equals(Object other)
equals in class JDFRangeother - the object to compare with this
public int hashCode()
hashCode in class JDFRangethispublic String getLeftString()
public double getLeft()
public String getRightString()
public double getRight()
public void setLeft(double x)
x - the left double objectpublic void setRight(double x)
x - the right double objectpublic void scale(double f)
f - the scaling factorpublic double getLowerValue()
public double getUpperValue()
public boolean inRange(double x)
x - comparison value
public boolean isPartOfRange(JDFRange ra)
isPartOfRange in class JDFRanger - the range to test
protected Object getRightObject()
getRightObject in class JDFRangeprotected Object getLeftObject()
getLeftObject in class JDFRangeprotected boolean inObjectRange(Object other)
inObjectRange in class JDFRangepublic String getString(int precision)
JDFRange
getString in class JDFRangeJDFRange.getString(int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||