public class DimensionValue
extends java.lang.Object
DEFAULT_UNIT,
then the units are assumed to be those set on the design as a whole.
The following units are supported:
DimensionUtil| 限定符和类型 | 字段和说明 |
|---|---|
static java.util.regex.Pattern |
commaSeparatorPattern
Compiled pattern for CSS absolute pattern: "000.000,000.000"
|
static java.lang.String |
DEFAULT_UNIT
Default unit for the dimension.
|
static java.util.regex.Pattern |
dotSeparatorPattern
Compiled pattern for CSS absolute pattern: "000,000.000,000"
|
protected double |
measure
The numeric measure part of the dimension.
|
protected java.lang.String |
units
The units part of the dimension.
|
| 构造器和说明 |
|---|
DimensionValue(double theMeasure,
java.lang.String theUnits)
Constructs a DimensionValue given its measure and unit.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(java.lang.Object obj)
Compares this dimension value to the given object.
|
double |
getMeasure()
Returns the measure portion of the dimension.
|
java.lang.String |
getUnits()
Returns the units portion of the dimension.
|
int |
hashCode()
Returns a hash code for this
DimensionValue object. |
static int |
indexOfUnitLetter(java.lang.String value)
Finds index of the first unit character( pt, %, pc... ) in the String.
|
static DimensionValue |
parse(java.lang.String value)
已过时。
replaced by
StringUtil.parse(String) |
static DimensionValue |
parseInput(java.lang.String value)
已过时。
|
java.lang.String |
toDisplayString()
Returns the dimension value in localized format.
|
java.lang.String |
toString()
Converts the dimension value to a locale-independent string.
|
protected final double measure
protected final java.lang.String units
public static final java.lang.String DEFAULT_UNIT
public static final java.util.regex.Pattern dotSeparatorPattern
public static final java.util.regex.Pattern commaSeparatorPattern
public DimensionValue(double theMeasure,
java.lang.String theUnits)
theMeasure - numeric measuretheUnits - units part for the dimension.java.lang.IllegalArgumentException - if the unit is not supported.public double getMeasure()
public java.lang.String getUnits()
public static DimensionValue parse(java.lang.String value) throws PropertyValueException
StringUtil.parse(String)value - the dimension string to parsePropertyValueException - if the string is not validpublic static DimensionValue parseInput(java.lang.String value) throws PropertyValueException
StringUtil.parseInput(String, com.ibm.icu.util.ULocale)The string must match the following:
value - the string to parsePropertyValueException - if the string is not validpublic java.lang.String toString()
toString 在类中 java.lang.Objectpublic java.lang.String toDisplayString()
public static int indexOfUnitLetter(java.lang.String value)
value - an input stringpublic boolean equals(java.lang.Object obj)
true
if and only if the argument is not null and is a dimension value object
with the same measure and the same type of unit. The two dimension values
with different units are not equal, although they can be converted to
same measureequals 在类中 java.lang.Objectobj - the object to compare this dimension value against.true if this dimension value is equal to the given
one; false otherwise.public int hashCode()
DimensionValue object. The
result is computed with the exclusive OR of the two halves of the
long
integer bit representation of the measure, and the hash code of unit
string. The measure bit representation is exactly produced by the method
Double.doubleToLongBits(double), of the primitive double
value represented by the measure of this DimensionValue
object. That is, the hash code is the value of the expression:
whereint result = 17 + 37 * (int) ( m ˆ ( m >>> 32 ) ); result = 37 * result + getUnits( ).toLowerCase( ).hashCode( );
m is defined by: long m = Double.doubleToLongBits( this.getMeasure( ) );
hashCode 在类中 java.lang.ObjectCopyright © 2008 Actuate Corp. All rights reserved.