de.lessvoid.nifty.tools
Class SizeValue

java.lang.Object
  extended by de.lessvoid.nifty.tools.SizeValue

public class SizeValue
extends Object

The SizeValue class stores and manages size value strings. Such strings are used to store size representations. See the constants for all supported special kind of values.

Author:
void

Constructor Summary
SizeValue(String valueParam)
          Create a new instance using the given value.
 
Method Summary
 float getValue(float range)
          Get the value as float.
 int getValueAsInt(float range)
          Get the value as int.
 boolean hasHeightSuffix()
           
 boolean hasWidthSuffix()
           
 boolean hasWildcard()
           
 boolean isPercentOrPixel()
          Checks if the value contains either PERCENT or PIXEL.
 boolean isPixel()
          Checks if this value describes a pixel value.
 String toString()
          toString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SizeValue

public SizeValue(String valueParam)
Create a new instance using the given value.

Parameters:
valueParam - the String value
Method Detail

isPercentOrPixel

public boolean isPercentOrPixel()
Checks if the value contains either PERCENT or PIXEL.

Returns:
true when either PERCENT or PIXEL is given.

getValue

public float getValue(float range)
Get the value as float.

Parameters:
range - the size that percent values are calculated from.
Returns:
the result value as float

getValueAsInt

public int getValueAsInt(float range)
Get the value as int.

Parameters:
range - range the size that percent values are calculated from.
Returns:
the result value as int

isPixel

public boolean isPixel()
Checks if this value describes a pixel value.

Returns:
true if the given string value ends with PIXEL and false otherwise

toString

public String toString()
toString.

Overrides:
toString in class Object
Returns:
value

hasWidthSuffix

public boolean hasWidthSuffix()

hasHeightSuffix

public boolean hasHeightSuffix()

hasWildcard

public boolean hasWildcard()


Copyright © 2011. All Rights Reserved.