public class Position extends Object
Constructor and Description |
---|
Position(double value,
boolean isRelative)
Create a new Position with the supplied value
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
double |
getValue()
Gets the position value
|
int |
hashCode() |
boolean |
isRelative()
Returns true if this Position is relative, false otherwise
|
int |
makeAbsolute(int width)
Gets the absolute value for this Position by multiplying with the given width.
|
static Position |
parsePosition(String pos)
Parses the supplied String as a Position.
|
public Position(double value, boolean isRelative)
value
- the positionisRelative
- if true, the value is a percentageIllegalArgumentException
- if the value is less than zero, or if the Position is absolute and its value is not an integerpublic static Position parsePosition(String pos)
pos
- the string to parseIllegalArgumentException
- if the value is less than zero, or if the Position is absolute and its value is not an integerpublic boolean isRelative()
public double getValue()
public int makeAbsolute(int width)
width
- the width to use