Unit

Inheritance: java.lang.Object

public class Unit

Represents a length measurement

Constructors

ConstructorDescription
Unit()
Unit(double value, int type)Initializes a new instance of the Unit structure with the specified double precision floating point number and UnitType.
Unit(double value)Initializes a new instance of the Unit structure with the specified double precision floating point number.
Unit(int value)Initializes a new instance of the Unit structure with the specified 32-bit signed integer.
Unit(String value)Initializes a new instance of the Unit structure with the specified length.

Methods

MethodDescription
equals(Object arg0)
getClass()
getExtension(int type)get string by the type,may get “px” “pt” “%” and so one;
getType()Gets the unit type of the Unit.
getValue()Gets the length of the Unit.
hashCode()
isEmpty()
notify()
notifyAll()
parse(String s)Converts the specified string to a Unit.
percentage(double n)Creates a Unit of type Percentage from the specified double-precision floating-point number.
pixel(int n)Creates a Unit of type Pixel from the specified 32-bit signed integer.
point(int n)Creates a Unit of type Point from the specified 32-bit signed integer.
toString()get string representation of the unit.
wait()
wait(long arg0)
wait(long arg0, int arg1)

Unit()

public Unit()

Unit(double value, int type)

public Unit(double value, int type)

Initializes a new instance of the Unit structure with the specified double precision floating point number and UnitType.

Parameters:

ParameterTypeDescription
valuedouble
typeint

Unit(double value)

public Unit(double value)

Initializes a new instance of the Unit structure with the specified double precision floating point number.

Parameters:

ParameterTypeDescription
valuedouble

Unit(int value)

public Unit(int value)

Initializes a new instance of the Unit structure with the specified 32-bit signed integer.

Parameters:

ParameterTypeDescription
valueint

Unit(String value)

public Unit(String value)

Initializes a new instance of the Unit structure with the specified length.

Parameters:

ParameterTypeDescription
valuejava.lang.String

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getExtension(int type)

public static String getExtension(int type)

get string by the type,may get “px” “pt” “%” and so one;

Parameters:

ParameterTypeDescription
typeint

Returns: java.lang.String

getType()

public int getType()

Gets the unit type of the Unit.

Returns: int

getValue()

public double getValue()

Gets the length of the Unit.

Returns: double

hashCode()

public native int hashCode()

Returns: int

isEmpty()

public boolean isEmpty()

Returns: boolean

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

parse(String s)

public static Unit parse(String s)

Converts the specified string to a Unit.

Parameters:

ParameterTypeDescription
sjava.lang.String

Returns: Unit

percentage(double n)

public static Unit percentage(double n)

Creates a Unit of type Percentage from the specified double-precision floating-point number.

Parameters:

ParameterTypeDescription
ndouble

Returns: Unit

pixel(int n)

public static Unit pixel(int n)

Creates a Unit of type Pixel from the specified 32-bit signed integer.

Parameters:

ParameterTypeDescription
nint

Returns: Unit

point(int n)

public static Unit point(int n)

Creates a Unit of type Point from the specified 32-bit signed integer.

Parameters:

ParameterTypeDescription
nint

Returns: Unit

toString()

public String toString()

get string representation of the unit.

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int