org.cip4.jdflib.datatypes
Class JDFXYPairRange

java.lang.Object
  extended by org.cip4.jdflib.datatypes.JDFRange
      extended by org.cip4.jdflib.datatypes.JDFXYPairRange
All Implemented Interfaces:
JDFBaseDataTypes

public class JDFXYPairRange
extends JDFRange

This class represents a x y pair range (JDFXYPairRange). It is a whitespace separated list of 2 xy pairs separated by a tilde "~", for example "1.23 3.24 ~ 2.34 7.12"


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
JDFXYPairRange()
          constructs a xy pair range with all values set to 0.0 Double
JDFXYPairRange(JDFXYPair x)
          constructs a xy pair range with both values equal ("from x to x")
JDFXYPairRange(JDFXYPair min, JDFXYPair max)
          constructs a xy pair range with the given left and right xy pair
JDFXYPairRange(JDFXYPairRange r)
          constructs a xy pair range with the given xy pair range
JDFXYPairRange(String s)
          constructs a xy pair range with all values set via a string
 
Method Summary
 boolean equals(Object other)
          equals - returns true if both JDFXYPaiRanges are equal otherwise false
 JDFXYPair getLeft()
          getLeft - returns the left JDFXYPair object
protected  Object getLeftObject()
           
 JDFXYPair getLowerValue()
          getLowerValue - returns the lower value of the bounds
 double getLowerXValue()
          getLowerXValue - returns the lower x value of the bounds for example 2.9 4.5~6.3 7.9 return 2.9
 double getLowerYValue()
          getLowerYValue - returns the lower y value of the bounds for example 2.9 4.5~6.3 7.9 return 4.5
 JDFXYPair getRight()
          getRight - returns the right JDFXYPair object
protected  Object getRightObject()
           
 JDFXYPair getUpperValue()
          getUpperValue - returns the upper value of the bounds
 double getUpperXValue()
          getUpperXValue - return the upper x value of the bounds for example 2.9 4.5~6.3 7.9 return 6.3
 double getUpperYValue()
          getUpperYValue - return the upper y value of the bounds for example 2.9 4.5~6.3 7.9 return 7.9
 int hashCode()
          hashCode complements equals() to fulfill the equals/hashCode contract
protected  void init(JDFXYPair min, JDFXYPair max)
          Initialization
protected  boolean inObjectRange(Object other)
           
 boolean inRange(JDFXYPair xypair)
          inRange - returns true if this contains xypair
 boolean isEqual(JDFXYPairRange g)
          isEqual - boolean equivalence
 boolean isPartOfRange(JDFRange ra)
          isPartOfRange - is range 'r' within this range?
 boolean isValid(String s)
          isValid - validate the given String
 void setLeft(JDFXYPair xy)
          sets the left JDFXYPair object of the range
 void setRight(JDFXYPair xy)
          sets the right JDFXYPair object of the range
 String toString()
          toString - returns the range as a String
 
Methods inherited from class org.cip4.jdflib.datatypes.JDFRange
getString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JDFXYPairRange

public JDFXYPairRange()
constructs a xy pair range with all values set to 0.0 Double


JDFXYPairRange

public JDFXYPairRange(JDFXYPair x)
constructs a xy pair range with both values equal ("from x to x")

Parameters:
x - left/right pair

JDFXYPairRange

public JDFXYPairRange(JDFXYPair min,
                      JDFXYPair max)
constructs a xy pair range with the given left and right xy pair

Parameters:
min - the given left xy pair
max - the given right xy pair

JDFXYPairRange

public JDFXYPairRange(JDFXYPairRange r)
constructs a xy pair range with the given xy pair range

Parameters:
JDFXYPairRange - r - the given xy pair range

JDFXYPairRange

public JDFXYPairRange(String s)
               throws DataFormatException
constructs a xy pair range with all values set via a string

Parameters:
s - the given string
Throws:
DataFormatException - - if the String has not a valid format
Method Detail

init

protected void init(JDFXYPair min,
                    JDFXYPair max)
Initialization

Parameters:
min -
max -

toString

public String toString()
toString - returns the range as a String

Overrides:
toString in class Object
Returns:
String - the range as a String

isValid

public boolean isValid(String s)
isValid - validate the given String

Parameters:
s - the given string
Returns:
boolean - false if the String has not a valid format

equals

public boolean equals(Object other)
equals - returns true if both JDFXYPaiRanges are equal otherwise false

Overrides:
equals in class JDFRange
Parameters:
other - Object to compare
Returns:
boolean - true if equal otherwise false

hashCode

public int hashCode()
hashCode complements equals() to fulfill the equals/hashCode contract

Overrides:
hashCode in class JDFRange
Returns:
int

getLeft

public JDFXYPair getLeft()
getLeft - returns the left JDFXYPair object

Returns:
JDFXYPair - the left JDFXYPair object

getRight

public JDFXYPair getRight()
getRight - returns the right JDFXYPair object

Returns:
JDFXYPair - the right JDFXYPair object

setLeft

public void setLeft(JDFXYPair xy)
sets the left JDFXYPair object of the range

Parameters:
xy - the left JDFXYPair object of the range

setRight

public void setRight(JDFXYPair xy)
sets the right JDFXYPair object of the range

Parameters:
xy - the right JDFXYPair object of the range

getLowerXValue

public double getLowerXValue()
getLowerXValue - returns the lower x value of the bounds for example 2.9 4.5~6.3 7.9 return 2.9

Returns:
double - the lower x value of the range

getUpperXValue

public double getUpperXValue()
getUpperXValue - return the upper x value of the bounds for example 2.9 4.5~6.3 7.9 return 6.3

Returns:
double - the upper x value of the range

getLowerYValue

public double getLowerYValue()
getLowerYValue - returns the lower y value of the bounds for example 2.9 4.5~6.3 7.9 return 4.5

Returns:
double - the lower y value of the range

getUpperYValue

public double getUpperYValue()
getUpperYValue - return the upper y value of the bounds for example 2.9 4.5~6.3 7.9 return 7.9

Returns:
double - the upper y value of the range

getUpperValue

public JDFXYPair getUpperValue()
getUpperValue - returns the upper value of the bounds

Returns:
JDFXYPair - the upper value of the range

getLowerValue

public JDFXYPair getLowerValue()
getLowerValue - returns the lower value of the bounds

Returns:
JDFXYPair - the lower value of the range

isEqual

public boolean isEqual(JDFXYPairRange g)
isEqual - boolean equivalence

Returns:
boolean - true if the ranges are equivalent

inRange

public boolean inRange(JDFXYPair xypair)
inRange - returns true if this contains xypair

Parameters:
xypair - comparison pair
Returns:
boolean - true if xy in range

isPartOfRange

public boolean isPartOfRange(JDFRange ra)
isPartOfRange - is range 'r' within this range?

Specified by:
isPartOfRange in class JDFRange
Parameters:
ra - the range to test
Returns:
boolean - true if range 'r' is within this range, else false

getRightObject

protected Object getRightObject()
Specified by:
getRightObject in class JDFRange

getLeftObject

protected Object getLeftObject()
Specified by:
getLeftObject in class JDFRange

inObjectRange

protected boolean inObjectRange(Object other)
Overrides:
inObjectRange in class JDFRange


Copyright © 2013. All Rights Reserved.